06-23-2010 08:24 AM
I am having trouble specifying the Current subscript in the ForEach step.
I have a local array of containers called FreqContainer where each container contains three numbers: LoFreq, MidFreq, and HiFreq.
On the ForEach Loop tab Array to Iterate Over is : Locals.FreqContainer, Current Element and Current Offset are blank. The Current Subscript is a string, Locals.Iteration.
In a step in the foreach loop I try to access one of the elements using:
Locals.CurrentFreqMHz = Locals.FreqContainer[Locals.Iteration].MidFreq
The subscript causes a problem, it appears to be '[''[0]'']'.
Can't find much useful documentation or examples on ForEach.
thanks, jvh
Solved! Go to Solution.
06-23-2010 08:34 AM
You probably need to do "[\"[0]\"]"
06-23-2010 12:53 PM
@Ray Farmer wrote:
You probably need to do "[\"[0]\"]"
Perhaps my post was unclear, In the expression "Locals.CurrentFreqMHz = Locals.FreqContainer[Locals.Iteration].MidFreq", Locals.Iteration is being interpreted as '[''[0]'']'
06-23-2010 02:05 PM - edited 06-23-2010 02:06 PM
Assuming you have a single dimensional zero-based array, you should use Current Offset, not Current Subscript.
The subscript is a string so that it can return a multidimensional subscript in a single value. To use it in an expression, you would need to call Evaluate such as:
Evaluate("Locals.MyArray" + Locals.Subscript) = 10
06-24-2010 09:47 AM
Thanks James.
I have been searching for documentation or an example that delineates the difference between subscript and offset. I think there could be a little more information on ForEach and examples that use "offsets" and subscripts. Being a text coder, subscript seemed logical to me.
Much obliged.
jvh