[Stackoverflow] [Progress OpenEdge ABL] How xml-node-type = 'hidden' play a role in a loop

Not open for further replies.

Rajesh khanna

I am writing progress 4GL code that builds an XML address tag based on multiple qualifiers like supplier, buyer, issuer of invoice, and delivery party using one temp-table tt_address.

for every address, we have streets 1,2 & 3. I want to show them in the XML if available else hide the tags.

Below is my code.

do i = 1 to num-entries(qualifiers):
create tt_address.
if ad_line1 <> ""
buffer tt_address:buffer-field("tt_address_street1"):xml-node-name = "STREET_1".
tt_address_street1   = trim(ad_line1).
buffer tt_address:buffer-field("tt_address_street1"):xml-node-type = "hidden".
if ad_line2 <> ""
buffer tt_address:buffer-field("tt_address_street2"):xml-node-name = "STREET_2".
tt_address_street2   = trim(ad_line2).
buffer tt_address:buffer-field("tt_address_street2"):xml-node-type = "hidden".
if ad_line3 <> ""
buffer tt_address:buffer-field("tt_address_street3"):xml-node-name = "STREET_3".
tt_address_street3   = trim(ad_line3).
buffer tt_address:buffer-field("tt_address_street3"):xml-node-type = "hidden".

Problem:- In the above case if the first loop passes the condition like ad_line1 <> '' and ad_line2 & ad_line3 = '' then it returns below <STREE_1>'ADDRESS1XXXXX'</STREET_1>

In the second loop (i.e., for other qualifier) if I have ad_line1 <> '' and ad_line2 = '' & ad_line3 <> '' then it is still giving ad_line1 only as below <STREE_1>'ADDRESS2XXXXX'</STREET_1>

Please let me know, how to overcome from this by not using separate temp-table for each address tag.

Hope it clarifies!!!

My analysis:- Because of first iteration making the tt_address_street2 & tt_address_street3 as "hidden" it is giving the next iterations as hidden only even though they have the information.

Actions I did:- For each loop starting I am making the node-type to "element" for all the tt_address_street tags as below buffer tt_address:buffer-field("tt_address_street2"):xml-node-type = "element". also observed that it is assigning the value for tt_address_street2, but in the XML generation, I couldn't see the value except <STREET_1> information.

Continue reading...
Not open for further replies.