Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

Array format

I want emails in array format like {"test@test.com", "test2@test.com" }

a!localVariables(
  local!data: ri!test_Requests,
  local!rawEmails: ri!test_Requests.emailAddresses,

  local!individualEmails: reject(
    a!isNullOrEmpty(_),
    a!forEach(
      items: split(local!rawEmails, char(10)),
      expression: trim(fv!item)
    )
  ),
  local!invalidEmails: reject(
    a!isNullOrEmpty(_),
    a!forEach(
      items: local!individualEmails,
      expression: if(
        regexmatch(
          pattern: "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$",
          searchString: fv!item,
          regexFlags: "si"
        ),
        null,
        fv!item
      )
    )
  ),
  local!formattedEmails: "{" & joinarray(local!individualEmails, """,""") & "}",

  local!validationMessage: if(
    a!isNotNullOrEmpty(local!invalidEmails),
    "Emails must be valid and each on a new line.",
    {}
  ),
  a!formLayout_25r1(
    label: "Test",
    contents: {
      a!sectionLayout(
        contents: {
          a!columnsLayout(
            columns: {
              a!columnLayout(
                contents: {
                  a!boxLayout(
                    label: "",
                    labelSize: "SMALL",
                    contents: {
                      a!columnsLayout(
                        columns: {
                          a!columnLayout(
                            contents: {
                           
                          
                            }
                          ),
                        
                        }
                      ),
                      a!paragraphField(
                        label: "Email Addresses",
                        labelPosition: "JUSTIFIED",
                        placeholder: "Email Addresses should be one per line (can be pasted from Excel)",
                        value: local!data.emailAddresses,
                        saveInto: {
                          a!save(
                            local!data.emailAddresses,
                            lower(save!value)
                          ),
                          a!save(
                            ri!test_Requests.emailAddresses,
                            lower(save!value)
                          )
                        },
                        refreshAfter: "KEYPRESS",
                        height: "TALL",
                        required: true,
                        requiredMessage: "Email Address is Required",
                        validations: if(
                          (
                            a!isNotNullOrEmpty(local!invalidEmails)
                          ),
                          "Emails must be in a valid format, and each email must be on a new line. ",
                          {}
                        )
                      ),
                      a!cardLayout(
                        contents: {
                          a!textField(
                            label: "The following emails could not be resolved against (or were linked to multiple) active employee records:",
                            value: joinarray(
                              a!forEach(
                                items: split(ri!incorrectemails, ";"),
                                expression: trim(fv!item)
                              ),
                              char(10)
                            ),
                            readOnly: true()
                          )
                        },
                        showWhen: ri!HasError = true(),
                        style: "INFO",
                        marginAbove: "NONE",
                        marginBelow: "LESS",
                        accessibilityText: "Information message"
                      ),
                      a!cardLayout(
                        contents: {
                          a!richTextDisplayField(
                            value: {
                              a!richTextItem(
                                text: "error:",
                                style: "STRONG",
                                size: "STANDARD"
                              ),
                              char(10),
                              a!forEach(
                                items: ri!emailRestrictions,
                                expression: a!richTextItem(
                                  text: {
                                    "EmployeeName: " & index(fv!item, "fullName", null) & " " & " error : " & index(fv!item, "restrictionName", null),
                                    char(10)
                                  }
                                )
                              )
                            }
                          )
                        },
                        accessibilityText: "Information message",
                        style: "INFO",
                        showWhen: ri!hasRestriction = true()
                      )
                    },
                    style: "#134f5c",
                    marginBelow: "STANDARD"
                  )
                }
              )
            }
          )
        }
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget_23r3(
          label: "Submit",
          style: "PRIMARY",
          submit: true,
          validate: true(),
          saveInto: {
            a!save(
              ri!FormattedEmails,
              joinarray(
                a!forEach(
                  items: local!individualEmails,
                  expression: char(34) & fv!item & char(34)
                ),
                ","
              )
            )

            ,
            a!save(
              ri!test_Requests.emailAddresses,
              local!rawEmails
            ),
           
            a!save(ri!test_Requests.isActive, true())
            /*a!save(ri!test_Requests.employeeIDs,index(ri!Result.body,"values",null()))*/
          },
          loadingIndicator: true()
        )
      },
      secondaryButtons: {
        a!buttonWidget_23r3(
          label: "Cancel",
          style: "NORMAL",
          submit: true,
          validate: false,
          value: true,
          saveInto: ri!cancel
        )
      }
    )
  )
)



In process variable I'm getting it as ""test@test.com","testing@tets.com"" but I want in format of {"test@test.com","testing@tets.com"}. 

Can someone please help

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Can you clarify what your use case is, exactly?  As in, why do you feel you need *that exact format*?

    I think what's missing, and what the other responses have missed so far, might be the fact that the Appian "text array" type is not represented visually in a consistent manner, as it's displayed slightly differently depending on whether you're looking at in-process data, data shown in a text/paragraph field, data shown in an expression output, or data shown in an "expressionable" manner i.e. what can be used in an expression to cause that array of data to be loaded / sent elsewhere / output.  And if you don't understand the difference between all of these ways, it will probably seem confusing (like you think you're not getting an "array output" somewhere when you actually are).

Reply
  • 0
    Certified Lead Developer

    Can you clarify what your use case is, exactly?  As in, why do you feel you need *that exact format*?

    I think what's missing, and what the other responses have missed so far, might be the fact that the Appian "text array" type is not represented visually in a consistent manner, as it's displayed slightly differently depending on whether you're looking at in-process data, data shown in a text/paragraph field, data shown in an expression output, or data shown in an "expressionable" manner i.e. what can be used in an expression to cause that array of data to be loaded / sent elsewhere / output.  And if you don't understand the difference between all of these ways, it will probably seem confusing (like you think you're not getting an "array output" somewhere when you actually are).

Children
No Data