I have a detail table where we are meant to keep empty row between rows that are populated with data. As a result of the design and depending on the data, some empty rows do appear at the end of the detail table and as such they will sometimes generate empty pages.
How can I remove trailing empty rows from the detail table whilst keeping intermediate millde row data are empty on the page.
example table:
row 1 with data
row 2 with data
row 3 with data row 4 empty
row 5 with data row 6 empty
row7 with data row8 empty row9 empty row10 empty
How can I remove row 8 to 10 from the detail table whilst keeping row 4 and 6?
The way how to remove these trailing empty rows depends on the way how you’ve created the detail table in your Connect Template. For example; Did you create the detail table by only making use of the “Insert Detail Table…” or “Insert Dynamic Table…” option? And by what kind of script are you creating this empty rows between rows populated with data?
I am using the Insert Dynamic Table in Connect. Empty rows are extracted from the pdf data file in the datamapper and contain non breaking spaces. I am simply using the Extraction steps.
But I think I have figured out myself how to remove the empty trailing rows using either a standard script or postpagination script.
Is there a simpler way to remove these empty rows? GMC software has a simpler right click menu option to remove trailing lines from dynamic table. Does Connect have a similar option?
There is an easy way to remove empty rows. In that case you’ve to check the option “Hide when empty” in the last step of the “Insert Dynamic Table…” window. You can simply check if you’ve checked this option by viewing your design in the Workspace “Source” mode. In that case the table-element will have the following attribute:
Just as a rectification, using data-hide-when-empty=“” will remove the whole table only if all of its data content is empty and only when used with data-detail tag. It will disregard any static text you might have added inside your detail table.
This part is only valid if you data wasn’t a PDF. Left it for other user who might have non PDF data
Now you best bet into achieving what you want would be to eliminated the undesired empty lines from a script in Workflow prior to the Execute Datamapping step.
Next, you need to add the tag data-keep-when-empty=“” in the <tr> of the detail table row you wish to keep empty lines. That will prevent them from being strip from table which is the default behavior when a detail table is build using the data-field tag.
** *Addition ***
Whilst re-reading my post (yeah I do that sometime ), another option occurred. You could as well, in your Datamapper add an Action, after the loop which generated your nested table, go through each of the sub-record, in reverse order, and replace all empty lines, from the end until you have a non-empty record, by a dummy string you know can’t occur in your data. Im my case, I used #####.
Script I used
var nbRecord = record.tables.detail.length;
for(var index = nbRecord-1; index >= 0; index--){
if(record.tables.detail[index].fields.Field1.trim() === '')
{
record.tables.detail[index].fields.Field1 = '#####';
}else{
break
}
}
Then, in your Template, it is only a matter of making your <tr>conditional so when the content of your field is #####, you hide the row.
I have the same requirement. I cannot see the option ‘Insert Dynamic Table’, so used ‘Insert Detail Table’. I thought detail and dynamic table are the same (read somewhere in the manual). I have data from an XML to be populated in detail table. It can have number of rows ranging from 1 up to 40.But it shouldn’t show the empty rows. It shows empty rows at the end when there is less number of rows than 40. Hence empty pages are generated at the end. Can you help please.
EDIT : I have achieved it with a standard script. The only issue I am now left with is, the last row (with data) is not getting shown along with empty rows also. Can you please advise what’s wrong with this script: