Please enable JavaScript to view this site.

InterFormNG2 Manual

You can include a dynamic image in InterFormNG2 by e.g. concatenating fixed strings with dynamic information from the input file e.g. like so:

 

NG2Fallback0001

 

The Xpath expression above:

concat('file:/D:/images/',./DocumentNo,'.jpg')

 

- builds the path to the image with the initial string: file:/D/images/ and the ending string: .jpg. In the middle we insert the contents of the DocumentNo subnode of the currently selected node in the input XML file. If the DocumentNo node e.g. has the value 1001, then this expression will try to use the image in D:/images/1001.jpg.

 

If this image file does not exist, then the rendering will stop with an error.

 

It is possible to verify if the image file exist and decide to insert another (or no) image instead, if the primary image does not exist.

 

If you want to do that, then you can use the ng:fileExist() function to verify if the image file exists or not.

A solution could look like this:

 

NG2Fallback0002

 

In the example above we test if the image file exist: If it does exist, then we insert the dynamic image concat('file:/D:/images/',./DocumentNo,'.jpg'), but if the image does not exist, then the image /Intro/demologo_C.jpg is inserted instead.

 

Each element is shown below:

 

The select element:

 

NG2Fallback0003

The dynamic image:

 

NG2Fallback0004

 

The fixed fallback image:

 

NG2Fallback0005