Using this both grid or nongrid data can be filled in the target tstruct on posting through Genmap.
- While filling from sql, sql node is mandatory in xml and sql fieldname and tstruct fieldname(to be filled) should be same.
- While filling from another grid sourceframe and map is mandatory.
- For filling from another grid, first the target dc should be filled from sql and then from grid.
- Filling from another grid will not fill all rows from source dc. It will check whether value of the key field exists in target dc, if it does not exist that row will be added to the target dc.
Following is the sample script to fill a single field in target tstruct.
s1:={<root><s1><sql><l1>select product_name from testproduct</l1></sql><key>product_name</key></s1></root>}
fill(s1)
xml should be in the following format.
<root>
<s1 fillon="new/modify">
<sql>
<l1>SELECT A.PRODCODE AS PCODE,B.RATE AS PRATE FROM PRODMAST A, POB B WHERE A.PRODMASTID = B.PRODCODE AND </l1> <l2>A.PRODCODE LIKE 'SANDALS -%' ORDER BY A.PRODCODE</l2>
</sql>
<key>pcode</key>
<new>add/first time/none</new> (default add)
<del>
<cond>iif condition(Expression)</cond>
<action>delrow/ignore</action> (default ignore)
</del>
<change> (default apply)
<apply>*</apply> (* means all,fields list should be given in comma seperated format)
<ignore>*</ignore> (* means all,fields list should be given in comma seperated format)
</change>
</s1>
<s3>
<sourceframe>dc2</sourceframe>
<map>pcode=prodcode,prate=rate</map>
<key>pcode</key>
<new>add</new>
<del>
<action>delrow</action>
</del>
<change>
<ignore>*</ignore>
</change>
</s3>
</root>