Dynamic repeating of rule inside foreach based on one ruleinput

Certified Senior Developer

I have a scenerio.The below mentioned example rule should repat based on the local variable local!a each input.

localvariablesa(

local!a: {"A","B","C"},

local!b : {"X","Y","Z"},

a!forEach(items: local!b,

expression :

rule!getTestData(input1 : ri!employee, input2 : local!a[1])[fvIndex],

rule!getTestData(input1 : ri!employee, input2 : local!a[2])[fvIndex],

.

.

.

.

rule!getTestData(input1 : ri!employee, input2 : local!a[n])[fvIndex],

)

)

  Discussion posts and replies are publicly visible

  • Can you please explain more clearly about the scenario and try     this outstanding feature next time you paste your code to make it more readable and sensible.

    AFAIU, what you want to achieve here can be done using the below sample code:

    a!localVariables(
      local!a: { "A", "B", "C" },
      local!b: { "X", "Y", "Z" },
      a!forEach(
        items: local!b,
        expression: a!localVariables(
          local!index: fv!index,
          a!forEach(
            items: local!a,
            expression: rule!getTestData(input1: ri!employee, input2: fv!item)[local!index]
          )
        )
      )
    )