I’m trying to take in a text file and create a report with it almost verbatim, however I need to get some proper paging in it.
I’m trying do this with a script to read in all the lines. If there is a better way, please let me know. I also haven’t figured out the best way to force paging, so any input you have there is appreciated as well.
It’s working, sorta…because of the line in red below, it gives me this error on my extraction step:
Error running script (Wrapped java.lang.Exception: The step is out of bound (DME000130) (#10)) (DME000019)
If I comment that line out, it does work, just not quite how I want it to.
var theEnd = false;
var LineOffset = 0;
var CurrentLine =“”;
var numBlanks = 0;
var strData = “”;
var blanklines = 0;
strData = “<p>”;while(!(theEnd))
{
CurrentLine = data.extract(1,85,LineOffset,1);if ((CurrentLine.trim() === "") || (CurrentLine.trim() === undefined)){numBlanks ++;} else {numBlanks = 0;} if(CurrentLine.match(/5.00.30/g) == null) { if (numBlanks < 3 || CurrentLine.trim() != "") {strData += CurrentLine.replace(/ /gim, '&nbsp;') + numBlanks + '<br/>';} } else { strData += '</p><p style="page-break-after: always;">&nbsp</p><p>'; } if (numBlanks >= 15 ) { strData += "</p>"; theEnd = true; } LineOffset++;
}
result = strData;
I’m trying to read in each line, strip out any extra lines(more than 1 blank line at a time), and if I run into a 5.00.30 in the report to ignore that line and page there.