Skip to main content
venkataharishd0002
January 21, 2021
Solved

Relplace applycomponents with foreach

  • January 21, 2021
  • 2 replies
  • 0 views

Hi Team,

We have an old code with applycomponents, Can you please help me to replace it with Foreach, I have tried but I'm unable to handle the '_'. Please help

a!applyComponents(
function: a!queryColumn(
field: _
),
array: ri!selectColumns
)

Thanks in advance

    Best answer by peter.lewis

    In order to use a!forEach() instead of a!applyComponents(), you have to reference your data using fv!item instead of the underscore. Try something like this:

    a!forEach(
      items: ri!selectColumns,
      expression: a!queryColumn(
        field: fv!item
      )
    )

    2 replies

    peter.lewis
    Employee
    January 21, 2021

    In order to use a!forEach() instead of a!applyComponents(), you have to reference your data using fv!item instead of the underscore. Try something like this:

    a!forEach(
      items: ri!selectColumns,
      expression: a!queryColumn(
        field: fv!item
      )
    )

    venkataharishd0002
    January 21, 2021

    Thank you so much Peter. [emoticon:c4563cd7d5574777a71c318021cbbcc8]