script code sample for looping through the records from xml data file in formCalc script
Hi I have a xml data file which contains a sequence of repeating applicant data like given below
US II CEO Mr 111111111 0000000111 GuarantorA 111 IN 11111 WILLIAMS1 R3 KENNETH1 City1GU PA 1934-03-14 firstname.lastname@example.org GU R 113 Lazlo LaneCA Suite 3500CA OaklandCA TX 11345 AL
I want to assign a textfield with a value based on the value of coap_flag. So i need to loop through all the record and check the value of coap_flag and then assign the textfield a value based on that.
I am new to Adobe livecycle...Please help me how it can be done.
I have developed something like this foreach Item in ($record.applicant[*].coap_flag) do test.value=Item if(test.value=="MA")then concat($record.applicant.first_name,$record.applicant.middle_name)endif endfor
No need to go through script to do this. In the dataview create a new connection and import a sample data file or the corresponding schema. A heirarchy of your xml file will appear. Locate the coap_flag field and drag and drop it onto the field that you want to set. A binding between the field and the data node is now established (you can see this by looking at the binding tab and on the heirarchy an icoon showing that this node is boound appears). Thats it....import you data file and the value will end up in that field.
I think u r not clear with my problem. I have given above the applicant data hiaerarchy which is in my data file. I have lot of applicant data available in the xml file with with this hiaerarchy. I want to display only some applicant details in a text field based on the value of the coap_flag. So i want to loop and check all the Applicant coap_flag and if the coap_flag matches my value i should be able to display my values in the field.
Now I am not able to get the loop executed. I am only able to get the value of the first Applicant..
I am only getting the data value of first applicant in the applicant hierarchy . For example in the above example i am getting the value of first applicant coap_flag value i.e "GU". But i need ti check other applicants coap_flag values also to decide which applicant data i need to enter within the textfield.
It has been a while since I played with the multiple occurances in the data dom. If you post a sample data file I can create a form that will show you how to get access to the individual repeating nodes. You can post it to email@example.com.