So far this forum is 0 for 1 on my requests, but here goes:
I have a flow service that returns a result list from a database and attempts to put it in a different format. I broke the issue down to its essence and wrote a very simple flow service to illustrate the problem.
It takes a document as an input that contains a document list called “results” (just like a data adapter). I have a pipeline variable called EFOLDER_ITERATION. I want to grab the result with an index of EFOLDER_ITERATION and put the value in a string.
The documentation says to simply put %EFOLDER_ITERATION% as my source index in the map step. This does not work. It only works when i hard-code in the number.
I am quite frustrated. Any help is TRULY appreciated.
Attached is a screen shot of the service as well as the attribute screen of the link:
You know which indexed item in the array you want, and you specify that value in the results box instead of %EFOLDER_ITERATION%. For example, since the array is base 0, you put 0 in the box, you will get the value of Value for item index 0.
Create a loop, make the in-array TestDoc/results. You will no longer see the array (multi-doc) but a single results document of which you will be able to map out the value of Value to another variable. Also, if you choose to use the loop, there is a value called $iteration that contains the loop number, but keep in mind that $iteration is base 1 while your array is base 0, so you don’t get confused by the numbers. The reason you would use this approach is if you wanted to extract a value from the array and on certain conditions, append the value to another array or document list. If you have a one-for-one match, then you would specify an out-array and map the values from the one array or document to the other.
What version of IS are you using? I believe that beginning in 6.01 you could specify a variable containing the index on the Link Properties dialog of a MAP statement. Prior to this version you have to either specify a hardcoded value or use one of the approaches that Ray suggested above.
I think we’ve hashed and re-hashed this issue several times in the discussion forums. See the following threads for details:
In response to Ray’s suggestion, if I use a 0 it works fine. However, that doesn’t do what i need.
Actually, i am attempting to take a recordset that looks like this:
EFOLDER EDOC QE(QualityException)
1 1 1
1 1 2
1 2 3
2 3 4
2 3 5
3 4 6
And turn it into a document like this (for use in a report):
EFOLDER[0]
–ID: 1
–EDOC[0]
----ID:1
----QE[0]
------ID:1
----QE[1]
------ID:2
–EDOC[1]
----ID:2
----QE[0]
------ID:3
EFOLDER[1]
–ID:2
–EDOC[0]
----ID:3
----QE[0]
------ID:4
----QE[1]
------ID:5
EFOLDER[2]
–ID:3
–EDOC[2]
----ID:4
----QE[0]
------ID:6
To do this, i was using the db output as the in-array and no out array (since the output is in more of an “xml-like” format, with nested attributes). Once again, if i use hard-coded numbers as the indexes, it works. However, of course, I need these indexes to change. I was using “efolder iteration” and “edocument iteration” to keep track of where i was on those fronts, and as these values changed in the original loop, i know to add a new element to the final document. Here is a screen shot of what i am doing:
I am using wM 6.01 and i read both of those threads.
thanks
russ
I think you are making this too difficult. Indexes are property of the array, so let the array do that part of the job for you. For each new record from the database, just map it into the document structure that you need.
Upon report output, use the array index + 1 to generate your Line numbers or IDs.