Not able to save the values in rule input

Certified Associate Developer

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?

 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    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 

Reply
  • 0
    Certified Lead Developer

    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 

Children