Skip to main content
mohammeds7691
July 13, 2023
Question

Not able to save the values in rule input

  • July 13, 2023
  • 5 replies
  • 0 views

a!localVariables(
  local!publication: 
cast(
  typeof(
    'type!{urn:com:appian:types:ISR}ISR_StudyDetail'()
  ),{}
),
  a!boxLayout(
    label: "Publicaton Plan",
    contents: {
      a!gridLayout(
        totalCount: count(local!publication),
        headerCells: {
          a!gridLayoutHeaderCell(label: "Publication Type" ),
          a!gridLayoutHeaderCell(label: "Publication Name" ),
          a!gridLayoutHeaderCell(label: "Year Estimate" ),
          /* For the "Remove" column */
          a!gridLayoutHeaderCell(label: "" )
        },
        columnConfigs: {
          a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
          a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
          a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ),
          a!gridLayoutColumnConfig(width: "ICON")
        },
        rows: a!forEach(
          items: local!publication,
          expression: a!gridRowLayout(
            contents: {
              a!radioButtonField(
                label: "Publication Type",
                value: fv!item.publicationType,
                saveInto: {
                  a!save(ri!studyDetail,ri!studyDetail.publicationType)
                },
                required: true(),
                choiceLabels: { "Conference", "Journal" },
                choiceValues: { "Conference", "Journal" },
                choiceLayout: "COMPACT"
              ),
              a!paragraphField(
                label: "Publication Name",
                instructions: rule!ISR_er_InstructionsText(
                  data: fv!item.publicationName,
                  maxLength: cons!ISR_PARAGRAPH_LENGTH
                ),
                refreshAfter: "KEYPRESS",
                value: fv!item.publicationName,
                saveInto: {
                  fv!item.publicationName,
                  a!save(
                    fv!item.publicationName,
                    clean(fv!item.publicationName)
                  ),
                  a!save(
                    fv!item.publicationName,
                    trim(fv!item.publicationName)
                  ),
                  a!save(fv!item.publicationName,
                      ri!studyDetail.publicationName
                    ),
                    

                },
                required: true(),
                validationGroup: cons!ISR_VALIDATION_GROUP_SUBMIT,
                validations: rule!ISR_er_ValidateTextLength(
                  text: fv!item.publicationName,
                  textLengthAllowed: cons!ISR_PARAGRAPH_LENGTH
                ),
              ),
              a!dropdownField(
                label: "Year estimate",
                placeholder: "--- Select a Year ---",
                choiceLabels: cons!ISR_yearlistforpublication,
                choiceValues: cons!ISR_yearlistforpublication,
                value: fv!item.estimatedYear,
                saveInto: fv!item.estimatedYear,
                required: true()
              ),
              a!richTextDisplayField(
                value: a!richTextIcon(
                  icon: "close",
                  altText: "delete " & fv!index,
                  caption: "Remove " & fv!item.publicationType & " " & fv!item.publicationName,
                  link: a!dynamicLink(
                    value: fv!index,
                    saveInto: {
                      a!save(local!publication, remove(local!publication, save!value))
                    }
                  ),
                  linkStyle: "STANDALONE",
                  color: "NEGATIVE"
                )
              )
            },
            id: fv!index
          )
        ),
        addRowlink: a!dynamicLink(
          label: "Add Publication Details",
          value: {
            startDate: today() + 1
          },
          saveInto: {
            a!save(local!publication, append(local!publication, save!value))
          }
        ),
        rowHeader: 1
      )
    },
    iscollapsible: true,
    isInitiallyCollapsed: false(),
    marginBelow: "STANDARD"
  )
)

Hello,

I'm using Add, Edit, and Remove Data in an Inline Editable Grid to allow user to change/add/remove data directly in an inline editable grid.

However, not able to save the values in rule inputs and when I'm moving to another filed, the previous field input getting disappeared. Is my code correct?

 

    5 replies

    jakubf0002
    July 13, 2023

    Look on Appian example: https://docs.appian.com/suite/help/21.1/Editable_Grid_Component.html

    hard to review entier code but your local!publication is Array of type type!{urn:com:appian:types:ISR}ISR_StudyDetail so you in below code you are trying to add to that array Today() +1 (save!value). 

    If you want to append local!publication you need to add another object of type type!{urn:com:appian:types:ISR}ISR_StudyDetail

    addRowlink: a!dynamicLink(
    label: "Add Publication Details",
    value: {
    startDate: today() + 1
    },
    saveInto: {
    a!save(local!publication, append(local!publication, save!value))
    }
    ),

    July 13, 2023

    a!localVariables(
      local!publication: cast(
        typeof(
          'type!{urn:com:appian:types}studyDetail'()
        ),
        {}
      ),
      a!boxLayout(
        label: "Publicaton Plan",
        contents: {
          a!gridLayout(
            totalCount: count(local!publication),
            headerCells: {
              a!gridLayoutHeaderCell(label: "Publication Type"),
              a!gridLayoutHeaderCell(label: "Publication Name"),
              a!gridLayoutHeaderCell(label: "Year Estimate"),
              /* For the "Remove" column */
              a!gridLayoutHeaderCell(label: "")
            },
            columnConfigs: {
              a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
              a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
              a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
              a!gridLayoutColumnConfig(width: "ICON")
            },
            rows: a!forEach(
              items: local!publication,
              expression: a!gridRowLayout(
                contents: {
                  a!radioButtonField(
                    label: "Publication Type",
                    value: fv!item.publicationType,
                    saveInto: fv!item.publicationType,
                    required: true(),
                    choiceLabels: { "Conference", "Journal" },
                    choiceValues: { "Conference", "Journal" },
                    choiceLayout: "COMPACT"
                  ),
                  a!paragraphField(
                    label: "Publication Name",
                    /*instructions: rule!ISR_er_InstructionsText(*/
                    /*data: fv!item.publicationName,*/
                    /*maxLength: cons!ISR_PARAGRAPH_LENGTH*/
                    /*),*/
                    /*not sure why u need refresh*/
                    /*refreshAfter: "KEYPRESS",*/
                    value: fv!item.publicationName,
                    saveInto: {
                      clean(fv!item.publicationName),
                      /*not sure on the study details type for now commenting*/
                      /*a!save(fv!item.publicationName,*/
                      /*ri!studyDetail.publicationName*/
                      /*),*/
                      /**/
                      
                    },
                    required: true(),
                    /*validationGroup: cons!ISR_VALIDATION_GROUP_SUBMIT,*/
                    /*validations: rule!ISR_er_ValidateTextLength(*/
                    /*text: fv!item.publicationName,*/
                    /*textLengthAllowed: cons!ISR_PARAGRAPH_LENGTH*/
                    /*),*/
                    
                  ),
                  a!dropdownField(
                    label: "Year estimate",
                    placeholder: "--- Select a Year ---",
                    choiceLabels: cons!ISR_yearlistforpublication,
                    choiceValues: cons!ISR_yearlistforpublication,
                    value: fv!item.estimatedYear,
                    saveInto: fv!item.estimatedYear,
                    required: true()
                  ),
                  a!richTextDisplayField(
                    value: a!richTextIcon(
                      icon: "close",
                      altText: "delete " & fv!index,
                      caption: "Remove " & fv!item.publicationType & " " & fv!item.publicationName,
                      link: a!dynamicLink(
                        value: fv!index,
                        saveInto: {
                          a!save(
                            local!publication,
                            remove(local!publication, save!value)
                          )
                        }
                      ),
                      linkStyle: "STANDALONE",
                      color: "NEGATIVE"
                    )
                  )
                },
                id: fv!index
              )
            ),
            addRowlink: a!dynamicLink(
              label: "Add Publication Details",
              saveInto: {
                a!save(
                  local!publication,
                  append(local!publication, save!value)
                )
              }
            ),
            rowHeader: 1
          )
        },
        iscollapsible: true,
        isInitiallyCollapsed: false(),
        marginBelow: "STANDARD"
      )
    )

    Hi,

    I tried to debug the code and added the comments as well. Check the above code whether it is working for your requirement 

    mohammeds7691
    July 13, 2023

    Hi Saranya,

    columns "Publication Type" and "Year Estimate" inputs are getting stored in local variables but not in rule inputs.

    "Publication Name" column inputs/data not getting saved neither local or rule inputs.

    shanmathip7466
    Inspiring
    July 13, 2023

    Hi [mention:f6defbb8615443929ecfe63d4fe9cb1a:e9ed411860ed4f2ba0265705b8793d05],

    I would say, you can add and update using local variables and on the submit/ update button save the local variable to rule input