Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
curtiplas Frequent Contributor.
Frequent Contributor.
9814 views

Array index cannot have an external element reference

I'm creating an orchestration that will essentially loop through an "if then" using the decision step to compare each value in an array of values. However on the decision step I'm getting an error message when trying to use the ForEach index as the array control. Any ideas? (see attached screenshot)
0 Likes
8 Replies
lmattie Absent Member.
Absent Member.

Re: Array index cannot have an external element reference

Just use your own numeric working data variable. Initialize it to 0 or 1 and increment it at the beginning or end of the for each loop.
0 Likes
curtiplas Frequent Contributor.
Frequent Contributor.

Re: Array index cannot have an external element reference

I tried that as well to no avail. I created a numeric variable called "loop" set to default of 0 and then in the "IncrementLoop" step I'm incrementing it by 1.
0 Likes
curtiplas Frequent Contributor.
Frequent Contributor.

Re: Array index cannot have an external element reference

Looks like this is defect D21079; however, the proposed workaround doesn't work. I setup a calculation step to set Forloop equal to ForEach\Index but the error persists. Unfortunately it looks like they closed this defect with a workaround.
0 Likes
jgilmour Absent Member.
Absent Member.

Re: Array index cannot have an external element reference

Hi Curtis - sample Process App attached to demonstrate how to resolve. I also sent via your support incident.
0 Likes
jgilmour Absent Member.
Absent Member.

Re: Array index cannot have an external element reference

Hi Curtis - sample Process App attached to demonstrate how to resolve. I also sent via your support incident.
0 Likes
curtiplas Frequent Contributor.
Frequent Contributor.

Re: Array index cannot have an external element reference

Jackie Gilmour wrote:

Hi Curtis - sample Process App attached to demonstrate how to resolve. I also sent via your support incident.


I got the sample process app, reviewed the orchestration, but I still have questions. I updated the case.
0 Likes
curtiplas Frequent Contributor.
Frequent Contributor.

Re: Array index cannot have an external element reference

Hmm mayhaps there is a better way to do this?

Here is what I'm trying to accomplish when a specific transition is run on the Change Request Item:

Compare a specific set of fields on the Change Request Item with the same set of specific fields on the Service Asset Item. If the field values are different update the Service Asset Item with the Change Request Item's values.

The way I was originally going to do this was to fetch all the Service Asset Item's fields, look for the specific set of fields by comparing the dbname attribute to a set of hardcoded strings (e.g. "OS"). If they match, compare that fields value[]\displayvalue to the same field on the Change Request item's value[]\displayvalue, if they aren't equal pass the Change Request Item's field and value[]\displayvalue to a new working array which would then be used to update the Service Asset Item.


I'm hoping someone has a better idea on how to do this...
0 Likes
curtiplas Frequent Contributor.
Frequent Contributor.

Re: Array index cannot have an external element reference

So I ended up going a completely different route to achieve my outcome, mainly using a compare step to set a boolean variable for each field based on the DB value, copy it to a fieldvalue variable, then run a series of decisions to compare the fieldvalue variable with the string sent via the event notice for the associated field.


The entire orchestration is actually fairly lengthy so I've just attached a screenshot of a snippet of it.

My only challenge now is finding a way to update a field on the Service Asset Item to be empty if it was changed to be empty on the Change Request Item.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.