Hi,Having the below scenario,Having 2 different object lists as below. Now A type of object having 1,2,3 fields, similarly for B object list as well.A - 1,2,3
B - 1,2,3
Now in the first for each the Items will be A object list. foreach(
items: ri!A,
expression: foreach(
items: ri!B,
expression: {
If(fv!item[B.2] = fv!item[A.2],
"Hi",
"Hello"
)
}
)Here, I am getting an error on below line for referencing the fv!item of A's object list in second for each.fv!item[B.2] = fv!item[A.2]Can anyone help me out this? Thanks in advance.
Discussion posts and replies are publicly visible
To understand this better, you need to grasp the scope of functions and thrie variables. In this case, a!foreach and fv!item are key elements. fv!item is only accessible within the a!foreach loop. in your code, where you've defined a second a!foreach inside the first one, it will only address to the loop where you are using the fv!item/fv!index/etc. Depending on where you are using fv!item, it's value might change dynamically for example ->so you will have to store the value of above fv!item in a separate variable where you can access it in the nested one.
a!foreach( items: ri!A, expression: a!localVariables( local!upperLoopCurrentItem: fv!item, a!foreach( items: ri!B, expression: { If( local!upperLoopCurrentItem = fv!item, "Hi", "Hello" ) } ) ) )
Thanks, It worked. EREN_YEAGER , Stefan Helzle