Hello
I’m using a standard script on the designer to force page break depending table value
If i found ‘FRANS BONHOMME (’ on the table line value → page break → OK
On the table data i have some lines who contain ‘Z 2’ or ‘Z 3’ or ‘z 4095’
I don’t want to output these lines , so i have added the following lines in the script to do that :
if((Champ1.indexOf(‘Z 2’) == -1) && (Champ1.indexOf(‘Z 3’) == -1) && (Champ1.indexOf(‘Z 4095’) == -1)){
rows += currRow;
}
this part of script works.
but i want to add blank lines depending these values :
Z 2 → add 2 blank lines
Z 3 → add 2 blank lines
Z 4095 → add page break
SCRIPT
let $baseRow = query(‘tr’, results);
let data = record.tables.detail;
let rows = ‘’;
for (let i = 0; i < data.length; i++) {
let $clone = $baseRow.clone();
let currRow = $clone.attr(“data-breakable”,i).toString();
let Champ1 = data[i].fields.Champ1;
currRow = currRow.replace(“@row@”, Champ1) ;
// add pagebreak
if(i > 0 && Champ1.indexOf(‘FRANS BONHOMME (’) > -1){
currRow = currRow.replace(‘<tr’, ‘<tr style = “page-break-before:always;”’);
}
if((Champ1.indexOf(‘Z 2’) == -1) && (Champ1.indexOf(‘Z 3’) == -1) && (Champ1.indexOf(‘Z 4095’) == -1)){
rows += currRow;
}
}
results.html(rows);
INPUT FILE
START
e60eZ 2
blablablabla
e60eZ 3
blablablablablablablabla
e60eZ 4095
blablablabla
blablablabla
output
START
blablablabla
blablablablablablablabla
blablablabla
blablablabla