I'm creating a template where I need a fixed table height size.
Eg: I need a table with 10 rows. If I don't have sufficient data to fill these rows, they should be printed blank.
I saw in other threads that there is a way to limit the no. of rows by using <?for-each:TAGNAME[position()<10]?> around the first and last field in the table. However, I have a different situation. In the same table, I have 2 different repeating groups - one used in the 1st row and 2nd in the next row. So, I won't be able to use this function before the 1st row and end it after the 2nd row. If I use it only on one group, I can't limit the total no. of rows to 10. How can I accomplish this?
Also, when I used this position() on the first row for testing, the data came out blank. Please help.
Check your inbox forwarded the sample for filling row upto 10.
used below logic
<?for-each:G_1?> .... <?end for-each?> in one row of your table - need to get the count of first row and save it in a variable
next row of your table
<?if:xdoxslt:get_variable($_XDOCTX, 'var')<10?><?for-each:xdoxslt:foreach_number($_XDOCTX,1,10-xdoxslt:get_variable($_XDOCTX, 'var'),1)?> ............. <?end for-each?><?end if?> - this fill the rows if the above count is <10
As you said, I tried getting the count using the below in the first row and then used yours in the 2nd line by replace the 'var' but it didn't work. No blank lines are being displayed. I tried to print the 'cnt' just to see what value it holds and that's blank too. I tried initializing it to zero as well before the group. Please advise.