LOOP through a document

I’m very new to WM. Hope some of you can give me a 30 sec tutorial:
i have a document with two records (each record has 2 fields)
– filename
– filesize
– filename
– filesize

I want to loop through the document and debugLog “filename”. Sounds simple - but i can’t get it working. Please help :slight_smile: !!

Have you read Developer Users guide ? There is a chapter “Inserting Flow Steps” which talks about how to use loops. And there is a builtin service in WMPublic package “debugLog” which you can use to log filename.

i tried LOOP with input array = “/recordWithNoID”
then put a debugLog service inside the loop to just print “*** HELLO***”.
It’s NOT even reaching the loop.

I don’t know what i am doing wrong.

Hmmm I can’t think of what you could be doing wrong in a simple loop until I see the flow myself. My guess is that you have not indented the debugLog step inside the loop. In a flow service - indentation works like curly braces of Java or C - so here’s what your flow should look like

– loop [input array=/recordWithNoID]
----- debugLog [message=HELLO]

Hope this helps,

By viewing your reply “It’s NOT even reaching the loop”
I guess you “recordWithNoID” is just a document , so when it reaches loop will stop executing child steps.
You can loop over only lists (array of elements). So make your input “recordWithNoID” as documentList and check.

From your message I can see that, you are using a “doucment” with 2 records in it and trying to loop over!!.. You cannot loop over a document, create a documentList and provide this document list to ur loop as input array and it works.

for more information, refer to the developer guide on how to use loop, FYI… Loops can be used on StringList, DocList, etc…

You both answered a 3 year old thread

Four more years later… it helped me!