Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

lists

jscotti
Level 2
Level 2

Is there an easy way to create a list from an XML file? I have a process that executes a loop keeping count, but is not appeading to the list file.

I first get a count of the number of rows and set a counter to the number of rows + 1.

Then I figure the number of rows - 1.

If the number of rows is < = 0 it should end.

If the number of rows is > 0 it should append to the list.

I am using the folowing to append to the list

/process_data/countyXML/type/county[/process_data/@numTotal]/CDDESC

Once it appends to the list it should return to subtract again and loop accordingly.

the XML looks good. It's named countyXML and looks like this:

<type>

     <county>

          <CDDESC></CDDESC>

     </county>

     <county>

          <CDDESC></CDDESC>

     </county>

</type>

I am getting an invocation error when it tries to append to the list.

Any help would be appreciated.

0 Replies
_hussam_
Level 3
Level 3

hi scott,

I think the problem is with the XPATH,

"/process_data/countyXML/type/county[/process_data/@numTotal]/CDDESC"

try to use the number function even if you decalred the variable as int

/process_data/countyXML/type/county[number(/process_data/@numTotal)]/CDDESC

regards

Hussam

Abhinav_Sharma
Level 4
Level 4

Lists are 1 index based i.e. First item would be added at index 1 of the list, not from 0.

So pls check if your counter variable is starting from value 1. Rest of the thing seems to be fine.

Thanks,

Abhinav