Using Arrays for a Cross Reference Lookup

Issue:
You may have had to create a flow that needed to look up one value to find another value from a cross reference table. You know that performing this look up as you're looping through your records can really slow down the performance of  your flow.

For example, perhaps you need the full name of a US State and have a crosswalk of the State code and full name:

FL=Florida
GA=Georgia
TN=Tennessee
etc.

Solution:
You can query and assign your cross reference values to arrays at the beginning of your flow.

If it is a straight one to one cross reference then create two arrays, like StateCode and StateDescription can be defined on the Start node.

Variable Name = StateCode
Variable Type = Array
Variable Value = [] or new Array()

As you cycle through the cross reference values, assign StateCode[counter]=State Code and StateDescription[counter]=State Description.

StateCode[0]="FL"
StateDescription[0]="Florida"
StateCode[1]="GA"
StateDescription[1]="Georgia"
StateCode[2]="TN"
StateDescription[2]="Tennessee"

While your looping through your records and you come across the State Code, you can now find the State Description value to use.

i=StateCode.indexOf(stateCode)
if (i>=0) description=StateDescription[i]

Not just answers, providing solutions