Record reference within a LOOP step

I have a record reference with a structure like CostCenterBatch/CostCenter/…

Does anyone know what the LOOP step does to a record reference? It seems to change the CostCenter record list to just a CostCenter record while in the loop.
The CostCenter is a RecordList. As expected, when I do a MAP step within a LOOP I don’t specify the index of the CostCenter list because within a LOOP I will have access to the current CostCenter (the CostCenter element doesn’t show up as a list when I STEP through even though it is a list). I would like to replicate this functionality without using a loop step, but when I call getRecordListItem and remap it back to my record reference it becomes a list again. The reason is that I don’t want to have to put the index of 0 on every MAP line.

To make sure I understand your structure:

CostCenterBatch (record)
-CostCenter (record list)

You’re correct that a record list “becomes” a record while inside a LOOP. Not sure why you don’t want to use a LOOP but …

getRecordListItem doesn’t return a copy of the record you’re after, it returns a reference. So any changes made to the record are reflected in the list record as well (both references point to the same record). Are you iterating through all items in the list using an index to pass to getRecordListItem or just getting one or two entries in the list? Are you trying to modify data in the list or are you extracting data from the list to put somewhere else?

I’m not sure I understand what you mean by “remap it back to my record reference”. Can you share more details of your service?

Hi ,

I am trying to map individual values from a record list by looping over it into another record contained in record list.
I want to increase the record in thre record list as I loop thru.

But when I did this my last value is stored in the record list as a record ,is there any inbuilt service available to append a record to record list.


Two ways to do this:

use a loop
specify an in-array
specify an out-array

The out-array will automatically grow as needed.

There is a service named pub.list:appendToRecordList. Use this in conjuction with a loop.

use a loop
specifiy an in-array
do not specify an out-array
map in-array entry to temp record
drop temp record

Really wierd behavior in dealing with generating recordReference output from within a loop step.

If you are trying to map from a recordList to a recordReferenceList within a loop step, I have found the following behavior.

If you create your mappings (from the inputRecord which is the in-array and to the recordReferenceList) and THEN specify your out-array as the recordReferenceList you will get the correct mapping but only for the final input.

If you specify the out-array as the recordReferenceList and THEN create the mappings from the in-array to the recordReferenceList (note: everything on the screen looks EXACTLY the same) you will get a single output which is an object reference.

If anyone else has investigated this further please let me know.

This is most likely because you need to ‘drop’ the record you are mapping from at the end of the loop, before it moves to the next record.

Order of creating lists and when you define the mapping is VERY important. You should always specify the in-array and out-array before adding any operations under the loop.

Creating out-arrays can be confusing and troublesome. Try this:

loop over inList (outList is out-array)
–map from inList record to a new record ref (not outList)
–map new record to outList
–drop new record

With this, you’re sure to get a unique record for each entry in the out list.

Rob, what do you think is the underlying reason for having to declare the in-array and out-array before creating the actual map? In theory, shouldn’t the entire Flow be a snapshot and not dependent upon order of events?

I guess this files under “Quirks and Oddities” because it defies logic. As nmorley found out, (Identical Flow) + (Identical Input) = Varied Results.

Most of us have seen this issue at one point or another and even ryan’s suggestion is a valid response.

Can anybody from webMethods fill in the gaps here? What is the best approach to mapping within RecordLists?

I had similar issues performing a conditional parse within a loop, performing transformations on a detail record list. Not being a huge fan of out arrays, I tend to use a method similar to that mentioned by Rob Eamon above.

This caused problems where there were two records where the value had to be transformed, one of which was validly null. By mapping within the loop from the transformed value (scalar) to the output (array) caused the populated value to be duplicated in the record which should have been null. see IS Developers guide Appx. C

Within the loop, setting a record counter to $iteration -1, using pub.list.getRecordListItem and pub.list.setRecordListItem is a quick and dirty way to get the right data back where I want it.


Rob & I definitely settle this problem the same way (in fact I think he showed me first!). The only way to make sure that the output array is unique is to map to an intermediate or temporary variable prior to mapping to the final out array.

One other possibility is to declare a separate list or record structure and not declare it the out array. In the last step of the loop, use the appropriate append method.


As we all have encountered at various points in our FLOW-coding lives, FLOW definitely gets confused sometimes. Well, more precisely it’s the FLOW editor…

I’ve had trouble in the past with copy/cut and paste. Significant changes to loop and branching structures also seem to cause troubles. In this case it’s usually best to just start over.

Think of the looping behavior as though it were Java code. In a Java loop, one would declare a new record to be placed in the out array during each iteration. In FLOW, you have to do this too. FLOW doesn’t automatically create a new record for each record list entry (at least that’s what the reported behavior is indicating). What makes this more confusing is that it DOES do this for string lists.

Lastly, my apologies for the misleading post above dated July 22, 2002. I didn’t point out that a temp record is the way to go even when using an out-array.

Can someone help me map from a record derived from a HTML table (via documentToRecord service) to a record with meaningful field names. For example:
--------------TD (string array)
--------------TD (string array)
--------------TD (string array)
--------------TD (string array)



IF you are using V4.6 of Integration Server, look for pub.web:queryDocument.

This service is deprecated in V6.01, but, it is still there, even if you cannot see it in your developer.

In the older version, it would allow you to parse HTML files as well as XML files.

Also, the Built-In services guide has references to this but specifies that it is deprecated. Also, has information on the replacement service which is pub.xml:queryXMLNode.

Hope this helps.


I trying to map a deeply nested array onto another one and am facing problems. This is a sample of the array.

Level 1 […]
–Level 2 […]
----Level 3 […]
------Level 4 […]

This array has to be mapped onto another array of similar structure. I’ve tried the following.

First without using the loop statement at all, if I directly map elements, I get an output upto level 2 correctly. When I try to set up nested loops, I get null values at level 3 and no further.

For the loops, when setting up the in-array, I use the sub-level within. I then set the out-array in a similar fashion. Now, for the loop properties, I see a default index of 0 gets entered. I played around with that for a while as I thought it might be the problem. However, I can’t save a variable ($iteration) as this index.

Can someone help. I’m attaching two snapshots of loop structures I’ve tried. Structure2 demonstrates the map structure that at least produced ‘Level 3’ as an enumerated object type of the right count for the first ‘Level 2’ record. Values were null however.

Structure 1

Structure 2

U need to nest each individual level seperately, (see below ex.)

Loop L1(Input array) O1(output array)

  • Loop L1/L2(Input array) O1/O2(output array)
    – Loop L1/L2/L3(Input array) O1/O2/O3(output array)
    — Loop L1/L2/L3/L4(Input array) O1/O2/O3/O4(output array)
    ---- Sequence of map statements


Bhavani Shankar

Isn’t that Structure 1 I’ve shown. Each of the individual map structures there, contain mappings for data at that level. However, it still maps only upto level 2 and no further.

The sequence of map statements can have the mappings of level1 fields to outputlevel1 fields.

Your structure 1.1 have mappings of each level at the corresponding loop level. But the example i posted in the previous mail had the mappings at each level shifted to the deepest map statement.

ie all the mappings from input to output across levels has been done in the sequence of map statements.

Hope this helps.
Bhavani Shankar

That didn’t work either. The array is a document that gets created from by a flat-file parsing schema. The array itself contains data; I’m trying to map it onto a ‘canonical’ (standard) form which has very similar structure.

Here is a picture of the results output tree if that helps. For every structure other than ‘Structure 2’, I did not get beyond level 2. Following picture demonstrates the error.



Could you post the entire structure of the input and output.
and what you intend to map…

Bhavani Shankar

Hey, thanks Bhavani, I got it to work. For anyone else grappling with a similar problem, Structure1 is what works. I have no idea why it was not working the first time, I recreated it and it worked.

What you have to be really careful with is the indices. webMethods automatically puts an index of 0 when you’re going down document arrays. I thought this might be a problem and tried replacing the indices with variables which it doesn’t allow. You have to delete the indices (of 0) that it puts in, for both in and out arrays, and then most likely it will work.