Monday, February 22, 2016

eText : Conditional NewLines


Continuing this series on my rants on eText template. I came across what looked like a pretty straightforward requirement from a customer. They wanted a conditional newline in the generated output. Instead of printing each XML record in a new line, the ask was to print four XML records in one text line. Batches of four. So a newline had to be printed after each 4 XML records. cleartext.blogspot.com
If you refer to the Oracle documentation on the eText template, there is a place to specify the New Record charachter.

image
The instruction ‘Carriage Return’ inserts a new line charachter just before the command <NEW RECORD> appears in the template. So conditionally insert a new line in a template, the Carriage Return has to be set to NULL. cleartext.blogspot.com
image
And then begins the tedious part. All through the template, whenever you need to insert a new line, you have to print the charachter using the CHR command. cleartext.blogspot.com
Example:   image
Another One:  image

And to conditionally print a new line after 4 xml records, the MOD command has to be used to calculate the position. Like so:
image

Its tedious, but thats the only way to do it in eText. cleartext.blogspot.com


cleartext.blogspot.com