Inserting Dynamic Bar Code Using JavaScript

To insert a Bar code that utilises both a dynamic value from the XML and another value (page number for demonstration purposes) use the following steps:

1. Enter XML view
2. Insert the following command before <fo:layout-master-set>

<xfd:attribute-value object="3F4C15EC" attribute="xf:value" condition="true()" dynamic-value="concat('javascript:function doSomething(recNo, ID){pageNo = $pageNumber; str=recNo+&quot;xxx&quot;+pageNo+&quot;xxx&quot;+ID;return str;}; doSomething(&quot;', string(text()), '&quot;,&quot;', string(@id) ,'&quot;);')"/>

*the script inserts in the bar code firstly the node "recNo" adds the quoted string "xxx" adds the page number it's on, again same string and finally ads the value of the Atribute "ID"

3. Go back to design view
4. Insert repeating paragraph (from Insert Tab)
5. Select the root to the required node (delete the customizing text)
6. Insert a barcode (code 128)
7. Scroll down to "Dynamic Values"
8. Add new condition
9. Create Expression
10. true()
11. In value use the following expression:

concat('javascript:function doSomething(recNo, ID){pageNo = $pageNumber; str=recNo+"xxx"+pageNo+"xxx"+ID;return str;}; doSomething("', string(text()), '","', string(@id) ,'");')
Press  save button.


Have more questions? Submit a request


Powered by Zendesk