Set record limits with more than one parameter with JavaScript in TXT file

I need to set limits for separating my TXT file.
We are converting the Planet press6 applications we have to this new version of conect that we purchased.
In the previous version we used the script below, and we need to do the same in this new version, where we have 3 conditions to define limits for each record.

if( (( pos(’ 1 ', &str ) = 32) OR( pos('BL.: ’ , &str ) = 214) OR( pos('4183D ’ , &str ) = 34) ) and (&current.line > 0 ) )
doform()
clearpage()
endif()
&current.line := &current.line + 1
store(&current.line,&str)
if(ge(&current.line,&current.lpp))
doform()
clearpage()
endif()

The attached data mapping configuration uses scripted boundaries to look at the 3 conditions you outlined. I created a dummy text that includes all 3 possibilities on various lines to demonstrate the logic works.

For this type of scripted boundaries, you have to set the Page Delimiter type setting to On lines and the Cut on number of lines setting to 1 so that the boundary script gets called on each and every line of the input data file. Each line is then parsed for one of the three specific values and when one is found, it marks the current location as a new boundary:

var is1       = (boundaries.get(region.createRegion(32,1,34,1)))[0]
var isBL      = (boundaries.get(region.createRegion(214,1,217,1)))[0]
var is4183D   = (boundaries.get(region.createRegion(34,1,38,1)))[0];
logger.info(is1 + " - " + isBL + " - " +is4183D);
if( (is1===" 1 ") || (isBL==="BL.:") || (is4183D==="4183D") ){
	boundaries.set();
}

PPSuiteConversion.OL-datamapper (3.4 KB)

Phil,

Thank you very much.

It worked very well and more importantly, I learned the logic of how to assemble and adapt it for other applications.