Expand my Community achievements bar.

Setting table dynamically

Avatar

Former Community Member

Hi,

I have a requirement where the form prints data from SAP.

I have a field COMMENT field in the form, that should print Rich Text with XHTML format. As data from SAP doesn't have XML tags, I did the following in the INITIALIZE event of the COMMENT field

var envel = '<?xml version="1.0" encoding="UTF-8"?><exData contentType="text/html" xmlns="http://www.xfa.org/schema/xfa-template/2.8/" xml:space="pre"><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acroform:2.7.0.0" xfa:spec="2.1" xfa:space="preserve"><p>PLACEHOLDER</p></body></exData>';

// HTML formatted data input. INPUTSAP is the field from SAP that has data in HTML format
var htmldata = $record.INPUTSAP.value;

// insert into envelope. This will wrap the HTML data with necessary XML tags
var newStr = envel.replace("PLACEHOLDER",htmldata);

// load into current element
this.value.exData.loadXML(newStr, 1, 1);

This work pretty fine, the output is just as expected.

But I have to do this for a table. I would be printing a table in the form, that gets the data a SAP table, say TABSAP. I have 2 problems

1. For each form table row how to access the corresponding row in TABSAP

2. The number of records in TABSAP is unknown, so how do I initialize the form table, because the form table should have the same number of rows as that in TABSAP.

Any ideas, please suggest.

Thanks

Charli

0 Replies