Looping over child recordlists

Hi ,
I’m trying to load XML to database and I have a problem in looping.
XML format goes like this
Workbook contains many worksheet record list and worksheet contains data record list.
I’m trying to use nested loop.
workbook
worksheet
data

Then you need to follow 3 nested loops

It should look like this.

Loop-WorkBook
–Loop WorkSheet
–Loop Data

Ignore this scenario if it didnt work.

Cheers:)

I’m also looping over Workbook , Worksheet and Data but the flow doesn’t enter Data loop.

Thanks,
Anu

Hello,

Are you sure that every time you read this xml, you will always have into a specific ? maybe you’re not receiving apropriate data and this may be causing this failure…

Hope this helps…

best regards.

Hi ,

Yes, the XML sample which I am using does have the data records under Worksheet.

I’m trying to loop Data under worksheet and worksheet under workbook.I’m not using any temp record list in the out array of the loop.

Thanks,
Anu

Two things to check:

  1. Are you typing the full path in each loop? For example, your loops should be for:

/workbook
/workbook/worksheet
/workbook/worksheet/data

  1. (In wM Developer) put a map into each loop and make sure that the list you are looping over now looks like a single instance. For example:

map1
/workbook
map2
/workbook/worksheet

In map 1, if you drill down into the record structure, workbook and worksheet will look like record lists. In map 2, workbook should look like a single record.

Enjoy…

JSilver

Anu,

Do you have content in the workbook elements?

Hello,

You can check if whitin a worksheet element have only one , if so, probably you will have a record instead a record list to loop through… to override this, you can create a record with your correct structure specified and in “recordName” parameter of documentToRecord service you put this record to enforce the structure to behave like you want when you import your XML, this way, you will always have a record list even when you have just one element…

If you try this way, you’ll have to set too the “makeArrays” parameter to “false” into documentToRecord service…

Hope this help…

Thanks to JSilver and others ,with the full path in the nested loops I could enter the data loop and load the XML into the database.

Regards,
Anu