Skip to main content
April 26, 2022
Question

Save the values and display it into a rule input by a!foreach loop for version 21.1

  • April 26, 2022
  • 4 replies
  • 0 views

Hi All,

How to save a values and display that values into rule input by a!foreach loop?

for example : in a!foreach loop there is a condition that text1 is having a datatype "string" value. I want to dynamically populate text fields in a form layout interface. How to save the user response?

a!forEach(
local!data,
if(fv!item.text1= "String",{
a!textField(
label: fv!item.text1,
labelPosition: "ABOVE",
saveInto: {},
refreshAfter: "UNFOCUS",
)

})

)

Please guide me how to achieve it for version 21.1.

4 replies

gopalk2865
Participating Frequently
April 26, 2022

Hi Yash, Could you please explain your use case? i am not able to understand what do you want to achieve exactly.

yashg0003Author
April 26, 2022

Hi Gopal, I want to dynamically populate text fields in a form layout interface. How to save the user response

gopalk2865
Participating Frequently
April 26, 2022

Hi Yash, If you are using a!foreach then to save these values , you would need to create your rule input as type of array, then using fv!index you can save the values. Please see below sample example,

a!localVariables(
local!data:{"value1","value2"},
  a!forEach(
    items: local!data,
    expression: {
      a!textField(
        label:  "text field" & fv!index,
        value: fv!item,
        saveInto: {
          fv!item,
          a!save(ri!data[fv!index],save!value)
        }
      )
    }
  )

)

my rule input here is array type. I hope it helps.