Ask Reuben


What is RTL?

What is PXML?

What is difference between RTL and PXML?

Within the Genero Report Writer vernacular there are two terms that sometime cause confusion, are they the same thing?, if they are different what is the difference? sometimes they are used interchangeably.  Those two terms are RTL and PXML.

The reason people think they are the same thing is because they are both entered the same way.  They are both entered by clicking on the fx button on the right hand side of a property.

… however there is a subtle difference you may not have not have noticed in the dialog that appears.  When editing RTL you will see “Edit RTL Expression” …

… but when you are entering PXML, the dialog will say “Edit Expression” …

… so if you are ever unsure of wether you are working with RTL or PXML, look at the title in the dialog.

The other key difference that I fallback on, if you study the Genero Report Writer architecture

… RTL is used when you receive the XML data-stream and you work out the values of properties based on the data received.  For example, you might set a Color property to be an RTL expression fieldname<0?Color.RED:Color.BLACK, whereas PXML is used when you generate the formatted data-stream and layout the report onto a page.

If you can think of the Genero Report Engine working in stages or phases, the RTL evaluation is performed before the PXML evaluation.  RTL when the data-stream is received and then PXML when the page is produced.

So in terms of the architecture diagram, RTL evalaution occurs after the pointy end of the Extract arrow, and PXML evaluation occurs before the Format arrow.  Deep down the Genero Report Engine has a few more stages.  You may have seen these if ever asked to produce a series of debug files that show the progress along those stages.

With this PXML sentence here ...

If a property is of type Measure of Distance, Ratio, or PXML String Expression, its value is defined using the PXML expression language.

... you can make that logical connection that PXML is used in the determination of Measure of Distance, Ratio.  These are terms you would use when generating a page layout, you are going to see Measures of Distance such as "3cm" to put an object 3cm from the edge, or ratios such as "max/2"  to put an object in the centre of its parent.

What confuses is the inclusion of "PXML String Expression" in the above.  This is necessary as there are some text values you may want on a page that you can only calculate when the page is being produced.  The most obvious of these string values is the Page Number or Total Pages.

You can also see this in the list of Barcode properties.  There is Code Value and Code Value Expression ...

... if you click on them, you will see one is for entering RTL, the other is for entering PXML.

Code Value is RTL and is used for expressions where you determine the Barcode value from the data received in the datastream, say a product code.

CodeValueExpression is PXML and is used for barcodes where you are including data such as Page Number embedded in the barcode.

I said earlier that you can think of RTL as being executed before PXML.  This is reinforced by the fact you can include RTL in PXML but you cannot include PXML in RTL.

Another thing you might observe, is that when entering RTL you have a number of RTL classes and their methods at your disposal.   You can review the RTL Class Reference and see that there is lots of methods.   Which ones you use will depend on the datatype of the property and what you are using in the expression.   These are all involved with taking values from the XML datastream and determining property values.

When working with PXML you have a number of special PXML variables and PXML functions you can use.   These are all used for positioning report elements onto a page.  So when you see min, max, rest, width(), length(), getPageNumber(), getTotalNumberOfPages(), this helps to reinforce that you are working with PXML.

So in summary, if you are unsure if working with RTL or PXML, look at the dialog box when entering the value.  RTL occurs before PXML.  RTL occurs starting with the data-stream received to set property values based on  expressions involving the data received.  PXML occurs when producing the page to determine dimensions and ratios, and text that is dependent on the page.

For more on expressions in properties, read here.