how do i store values into rule inputs if the length of list is Dynamic

Hi Team,

I am Self Learning appian and now creating  interfaces, i want  a requirement to create Repetitive Section Layout based on input integer value

Scenario is let a integer input vale named Number of clients count.

 now i have collect the first Name, last Name and some other fields of clients, i created a CDT for those client data and created a Rule input as the interface is as shown below, when the number of client value is empty , we are displaying only one section layout as default.

When i entered 2 as number of client, i got 2 section layouts

how since i use for loop to display the recursive section layout, when i enter the details of first client , its is copied into second layout also

i tried using indexing , but i faced problem when i am inserting data into fields.

How do store Values into list type rule input in this situation.

please help me, Thanks in advance I am attaching code for review. let me know if I made any mistakes

{
  a!cardLayout(
    contents: {
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!integerField(
                label: "No.of Clients:",
                labelPosition: "ABOVE",
                value: ri!NumberOfClients,
                saveInto: ri!NumberOfClients,
                refreshAfter: "UNFOCUS",
                validations: {}
              )
            }
          ),
          a!columnLayout(contents: {}),
          a!columnLayout(contents: {})
        }
      )
    },
    height: "AUTO",
    style: "TRANSPARENT",
    marginBelow: "STANDARD"
  ),
  a!columnsLayout(
    columns: {
      a!columnLayout(contents: {}),
      a!columnLayout(contents: {}),
      a!columnLayout(contents: {})
    }
  ),
  a!forEach(
    items: if(isnull(ri!NumberOfClients),1,1+enumerate(ri!NumberOfClients)),
    expression: {
      a!sectionLayout(
        label: "Client Data" & fv!index,
        contents: a!cardLayout(
          contents: {
            a!sectionLayout(
              contents: {
                a!columnsLayout(
                  columns: {
                    a!columnLayout(contents: {}),
                    a!columnLayout(contents: {}),
                    a!columnLayout(contents: {})
                  }
                ),
                a!columnsLayout(
                  columns: {
                    a!columnLayout(
                      contents: {
                        a!richTextDisplayField(
                          labelPosition: "COLLAPSED",
                          value: {
                            a!richTextItem(
                              text: { "Personal Details" },
                              size: "MEDIUM_PLUS",
                              style: { "STRONG" }
                            )
                          }
                        )
                      }
                    )
                  }
                )
              }
            ),
            a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "FirstName:",
                      labelPosition: "JUSTIFIED",
                      value:if(a!isNullOrEmpty(ri!ClientData),null,ri!ClientData.firstName),
                      saveInto: ri!ClientData.firstName,
                      refreshAfter: "UNFOCUS",
                      validations: {}
                    ),
                    a!integerField(
                      label: "Phone Number:",
                      labelPosition: "JUSTIFIED",
                      value:if(a!isNullOrEmpty(ri!ClientData),null, ri!ClientData[fv!index].phoneNumber),
                      saveInto: { ri!ClientData[fv!index].phoneNumber,  },
                      refreshAfter: "UNFOCUS",
                      validations: {}
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "LastName:",
                      labelPosition: "JUSTIFIED",
                      value: if(a!isNullOrEmpty(ri!ClientData),null,ri!ClientData[fv!index].lastName),
                      saveInto: ri!ClientData[fv!index].lastName,
                      refreshAfter: "UNFOCUS",
                      validations: {}
                    ),
                    a!textField(
                      label: "SSN:",
                      labelPosition: "JUSTIFIED",
                      value: if(a!isNullOrEmpty(ri!ClientData),null, ri!ClientData[fv!index].ssn),
                      saveInto: ri!ClientData[fv!index].ssn,
                      refreshAfter: "UNFOCUS",
                      validations: {}
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    a!dateField(
                      label: "Date of Birth:",
                      labelPosition: "JUSTIFIED",
                      value: if(a!isNullOrEmpty(ri!ClientData),null,ri!ClientData[fv!index].dob),
                      saveInto: ri!ClientData[fv!index].dob,
                      validations: {}
                    ),
                    a!textField(
                      label: "Gender:",
                      labelPosition: "JUSTIFIED",
                      value: if(a!isNullOrEmpty(ri!ClientData),null,ri!ClientData[fv!index].gender),
                      saveInto: ri!ClientData[fv!index].gender,
                      refreshAfter: "UNFOCUS",
                      validations: {}
                    )
                  }
                )
              }
            ),
            a!sectionLayout(
              label: "",
              contents: {
                a!richTextDisplayField(
                  labelPosition: "COLLAPSED",
                  value: {
                    a!richTextItem(
                      text: { "Address Details" },
                      size: "MEDIUM_PLUS",
                      style: { "STRONG" }
                    )
                  }
                ),
                a!columnsLayout(
                  columns: {
                    a!columnLayout(
                      contents: {
                        a!textField(
                          label: "AddressLine1:",
                          labelPosition: "JUSTIFIED",
                          value: if(a!isNullOrEmpty(ri!ClientData),null,ri!ClientData[fv!index].addressLine1),
                          saveInto: ri!ClientData[fv!index].addressLine1,
                          refreshAfter: "UNFOCUS",
                          validations: {}
                        ),
                        a!textField(
                          label: "ZipCode:",
                          labelPosition: "JUSTIFIED",
                          value: if(a!isNullOrEmpty(ri!ClientData),null,ri!ClientData[fv!index].zipcode),
                          saveInto: ri!ClientData[fv!index].zipcode,
                          refreshAfter: "UNFOCUS",
                          validations: {}
                        )
                      }
                    ),
                    a!columnLayout(
                      contents: {
                        a!textField(
                          label: "AddressLine2:",
                          labelPosition: "JUSTIFIED",
                          value: if(a!isNullOrEmpty(ri!ClientData),null,ri!ClientData[fv!index].addressLine2),
                          saveInto: ri!ClientData[fv!index].addressLine2,
                          refreshAfter: "UNFOCUS",
                          validations: {}
                        ),
                        a!textField(
                          label: "State:",
                          labelPosition: "JUSTIFIED",
                          value:  if(a!isNullOrEmpty(ri!ClientData),null,ri!ClientData[fv!index].state),
                          saveInto: ri!ClientData[fv!index].state,
                          refreshAfter: "UNFOCUS",
                          validations: {}
                        )
                      }
                    ),
                    a!columnLayout(
                      contents: {
                        a!textField(
                          label: "City:",
                          labelPosition: "JUSTIFIED",
                          value: if(a!isNullOrEmpty(ri!ClientData),null,ri!ClientData[fv!index].city),
                          saveInto: ri!ClientData[fv!index].city,
                          refreshAfter: "UNFOCUS",
                          validations: {}
                        ),
                        a!textField(
                          label: "Country:",
                          labelPosition: "JUSTIFIED",
                          value: if(a!isNullOrEmpty(ri!ClientData),null,ri!ClientData[fv!index].country),
                          saveInto: ri!ClientData[fv!index].country,
                          refreshAfter: "UNFOCUS",
                          validations: {}
                        )
                      }
                    )
                  }
                )
              }
            )
          }
        )
      )
    }
  ),

}

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data