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.
Then you need to follow 3 nested loops
It should look like this.
Ignore this scenario if it didnt work.
I’m also looping over Workbook , Worksheet and Data but the flow doesn’t enter Data loop.
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…
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.
Two things to check:
- Are you typing the full path in each loop? For example, your loops should be for:
- (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:
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.
Do you have content in the workbook elements?
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.