Want to Store 3 grid column values into 1 rule input

Certified Senior Developer

In this grid i have first name ,middle name, last name, these three variables while submitting i want to store it in one rule input.

Example :John jackie smith  (it should display like this)

can anybody help me on this

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to sindhup7044

    IMHO the only really good way of dealing with this, then, would be to have just one text field for "name".

    Even if you can concat the 3 pieces together into the "name" CDT parameter upon entering them into the Editable Grid fields, you're going to have an extremely difficult time separating them back out to populate the individual values for those fields.

    What is your use case for having 3 separate entry fields but not storing the values separately?

  • Agree with Mike's approach, this is not in the realm of best practices to store 3 values concatenated into one field.  I would suggest an enhancement if possible to move toward one field for each name part. 

    Additionally, when these are users with accounts/profiles, it is best to store the account identifier (chosen via user picker) and join to the user information for display later, so when they change names, you don't have very bad data.

    To know the use case here would definitely help.

    However I have seen some cases where this is done for ease of reporting, in simple processes where data is only used for a short term (still not what I would implement), the user account will be saved but also a secondary 'display name' field is stored with the CDT.  I don't recommend, but if there is a case it fits, you can just concatenate the CDT values in something such as the Submit button:

    a!localVariables(
      local!data: {
        a!map(firstName: "John", middleName: "Jackie", lastName: "Smith"),
        a!map(firstName: "Michael", middleName: "Stephanie", lastName: "Johnson"),
        a!map(firstName: "Mary", middleName: "Karlee", lastName: "Reed")
      },
      a!formLayout(
        label: "Test - Save User Names",
        contents: {
          a!gridLayout(
            headerCells: a!forEach(items: {"First Name","Middle Name","Last Name"}, expression: a!gridLayoutHeaderCell(label: fv!item)),
            rows: a!forEach(
              items: local!data,
              expression: a!gridRowLayout(
                id: fv!index,
                contents: {
                  a!textField(
                    value: fv!item.firstName,
                    saveInto: local!data[fv!index].firstName
                  ),
                  a!textField(
                    value: fv!item.middleName,
                    saveInto: local!data[fv!index].middleName
                  ),
                  a!textField(
                    value: fv!item.lastName,
                    saveInto: local!data[fv!index].lastName
                  )
                },
              )
            ),
            addRowLink: a!dynamicLink(
              label: "Add Employee",
              saveInto: a!save(
                local!data,
                append(local!data,{a!map(firstName: null, middleName: null, lastName: null)})
              )
            )
          )
        },
        buttons: {
          a!buttonLayout(
            primaryButtons: {
              a!buttonWidget(
                label: "Submit",
                submit: true,
                saveInto: {
                  a!save(
                    ri!userNames,
                    a!forEach(
                      items: local!data,
                      expression: concat(
                        fv!item.firstName,
                        " ",
                        fv!item.middleName,
                        " ",
                        fv!item.lastName
                      )
                    )
                  )
                }
              )
            }
          )
        }
      )
    )