in reply to HTML::Template question

In your 'TMPL_IF NAME=EXPORT_VALUE' loop you would need a data structure like this:
SCHEDULE_ROWS => [ { SCHEDULE_COLUMNS => [ { SCHEDULE => 'value' }, { SCHEDULE => 'value' }, ], }, ]
And in 'TMPL_IF NAME=IMPORT_VALUE' loop you would need this:
SCHEDULE_ROWS => [ { SCHEDULE => 'value' }, { SCHEDULE => 'value' }, ]
But in your code you have:
$data_structure{SCHEDULE_ROWS} = \@schedule_rows_loop; $data_structure{SCHEDULE_COLUMNS} =\@schedule_columns_loop;
which gives you:
SCHEDULE_ROWS => [ { SCHEDULE => 'value' }, { SCHEDULE => 'value' }, ], SCHEDULE_COLUMNS => [ { SCHEDULE_COLUMNS_COUNT => 'value' }, { SCHEDULE_COLUMNS_COUNT => 'value' }, ]
Try changing the template to:
<TMPL_LOOP NAME=SCHEDULE_ROWS> <tr> <td><b><TMPL_VAR NAME=SCHEDULE></b></td> </tr> </TMPL_LOOP> <TMPL_LOOP NAME=SCHEDULE_COLUMNS> <tr> <td><TMPL_VAR NAME=SCHEDULE_COLUMNS_COUNT></td> </tr> </TMPL_LOOP>

Replies are listed 'Best First'.
Re^2: HTML::Template question
by iRemix94 (Sexton) on Jul 21, 2015 at 13:16 UTC

    That's not what I want to get from the Template. Sorry, I probably didn't explain it in a good way. I have a table which has X amount of rows and X amount of columns. The rows are generated through the "SCHEDULED_ROWS" loop, while the columns should be generated through the "SCHEDULED_COLUMNS" loop. For every row in the table, there is a schedule value. Now, I want to have this schedule value for more than 1 column. like this:

    20:00 20:00 20:00 20:00 20:00
    13:00 13:00 13:00 13:00 13:00
      That's not what I want to get from the Template
      I was pointing out where the problem is, and showing you that your template has conflicting requirements. You will need to change both your template and the way you construct the data structure. If you can show a correct template it should be possible to advise on the data structure.

        Sorry, I am very new to PERL and don't know exactly what's the problem here. Could you explain my problem a little bit more? All I want is that table with X amounts of rows and columns.

        I updated the template file, for some reason the IMPORT loop wasnt the same as the export loop, my mistake. Maybe you can give me a tip how I can fix my data structure?