Problem mapping variables with dynamic indexes

Anybody experience problems with using dynamic indexes? (In a map step, instead of specifying a particular integer such as 0,1,2, etc…; using a variable as an index %variable%)

My situation is that the source document component is being mapped to a target array component (document array) and I’m trying to specify a dynamic target index rather than having to build a document list (by appending each component value to a list) and then copying the document list into a final document once I’m finished looping. My problem is that the map step works perfectly fine with an integer value (0,1,2,3, etc…) for the target index, but doesn’t work when I specify a variable reference (%variable%) for the target index instead of an integer.

Has anybody experienced this problem before?

I’m using Integration Server 6.1.5.

Thanks!
Chad

Yes. A search of the forums for “variable index” turns up many hits. These might be the most helpful.

http://www.wmusers.com/wmusers/messages/117/30719.shtml
http://www.wmusers.com/wmusers/messages/117/25803.shtml
http://www.wmusers.com/wmusers/messages/117/1797.shtml

Thanks. I did a search for mapping dynamic indexes, but I didn’t get any results…I imagine my search terms weren’t that appealing to the search engine.

I read the posts. Using the variable which represents my index is exactly what I want to do. Problem is, the mapping step doesn’t like it. I even created a variable and hardcoded its value to be 1. When doing a map, I must use an integer (0,1,2,3,4, etc…) because the map step executes but does nothing when I use a variable reference such as %variable% in place of the normal integer. I’m not sure why this is, it is definitely confusing. I’m begining to think the install just doesn’t like me.

I just did some testing on 6.1 and variable indexing does indeed work as advertised. Indexing beyond the end of the list even conveniently extends the size of the list.

Create a small test service to see that make sure that it does indeed work on your install. Use a map step first to create a string list, a new value variable and an index variable. In the second step map the new value variable to the list and set the map index to use the index variable. Set different values in the index variable to see what happens.

I created a generic string list and did some mapping to another string list and it worked perfectly with dynamic indexing (dynamic index variable was a string). I tried to do that same “experiment” with using generic document lists (again using a dynamic index variable that is a string) but the mapping didn’t work. I’m begining to think that the mapping doesn’t work for document lists, but will work for string lists.

Does the same occur for you?

Using a doc list with two fields (field1 and field2) works fine. The proper doc in the list is updated and the list is extended when the index is beyond the current length of the list.

Can you post your test service?

I believe there was something in the release notes for Integration Server at one stage about using pipeline variables for indexing may be unreliable (or “varying results” or something unsure like that)…
Perhaps it was in the 6.1 release notes as a fixed issue or something?
I can recall demo-ing it one time for a class, but that’s about it… never actually used it for production code.

regards,
Nathan

You jogged my memory Nathan. There was an alert issued last month. Portions of the alert:

“Potential data integrity or data loss situation with Integration
Server 6.1 when used with IS_6-1_Fix60 or IS_6-1_SP1.

Variable Substitution does not work if a Flow Map Step combines ALL THREE of the following:
Array indexing
Variable substitution
Transformer invocation
…”

To fix, need to apply SP1 and IS_6-1_SP1_Fix19 (or backout IS_6-1_Fix60, if that’s even possible).

Chad, you mentioned you’re running 6.1.5 so this alert wouldn’t seem to apply but it may be worth a WebEx with tech support to see if this is variation of the same bug and made it through to 6.1.5.

Rob/Nathan

Thanks for the information. I did some “experimenting” to see how the mapping behaves when using String Lists and Document Lists and dynamic indexing. The Document List Reference to which I am attempting to map is a large, nasty, deep structure. I don’t think that the service can reliably determine where it is at the deepest levels (where I need to iterate to) using a dynamic index. It has no trouble being told explicitly where to go (hard coding of integer). I decided on a more elegant method of mapping. It requires a slight bit more code, however, I think it is easier to read and doesn’t suffer from losing it’s way with dynamic indexes.

I broke the document lists that I want to map to out of the master document and into separate document list entities. I populate those document list entities (each one using the exact same variable for the dynamic index so they are “in sync”) based upon a loop iteration from my source data structure . When I’m finished, I reassemble the final document (a PR based on a nasty DTD) and ship it to Trading Networks for routing.

Thanks for all of the assistance and suggestions. Hopefully, I can return the favor sometime.

Chad. H.

I had the same issue when using variable substitution for indexes. I was using IS 6.1 without SP1. When i contacted webMethods tech support they asked me to apply SP1. After applying SP1 i didnot see this issue again.