Skip to main content
May 4, 2024
Question

Editable grid dropdowns

  • May 4, 2024
  • 13 replies
  • 0 views

Hello, I have editable grid in which I have 3 dropdowns, I'm picking up the values and choices from constants and have rule decisions based on that now for the first row it's working perfectly fine I select "Region" then "Country" and then "Language", but once I add new row I loose all the values from second and 3rd dropdowns and they become blank and I'm not able to select anything.

Here is the full code for the a!foreach is it something within the add row function?


                    rows: a!forEach(
                        items: ri!AOS_Documents_Required,
                        expression: a!gridRowLayout(
                          id: fv!index,
                          contents: {
                            a!dropdownField(
                              choiceLabels: cons!AOS_Regions,
                              choiceValues: cons!AOS_Regions,
                              label: "Dropdown",
                              labelPosition: "ABOVE",
                              placeholder: "--- Select a Value ---",
                              value: fv!item['recordType!AOS_Documents_Required.fields.Region'],
                              saveInto: fv!item['recordType!AOS_Documents_Required.fields.Region'],
                              searchDisplay: "AUTO",
                              validations: {}
                            ),
                            a!dropdownField(
                              choiceLabels: rule!AOS_region_country(region: ri!AOS_Documents_Required['recordType!AOS_Documents_Required.fields.Region']),
                              choiceValues: rule!AOS_region_country(region: ri!AOS_Documents_Required['recordType!AOS_Documents_Required.fields.Region']),
                              label: "Dropdown",
                              labelPosition: "ABOVE",
                              placeholder: "--- Select a Value ---",
                              value: fv!item['recordType!AOS_Documents_Required.fields.Country_Template'],
                              saveInto: fv!item['recordType!AOS_Documents_Required.fields.Country_Template'],
                              searchDisplay: "AUTO",
                              validations: {}
                            ),
                            a!dropdownField(
                              choiceLabels: rule!AOS_country_language(country: ri!AOS_Documents_Required['recordType!AOS_Documents_Required.fields.Country_Template']),
                              choiceValues: rule!AOS_country_language(country: ri!AOS_Documents_Required['recordType!AOS_Documents_Required.fields.Country_Template']),
                              label: "Dropdown",
                              labelPosition: "ABOVE",
                              placeholder: "--- Select a Value ---",
                              value: fv!item['recordType!AOS_Documents_Required.fields.SDS_Language'],
                              saveInto: fv!item['recordType!AOS_Documents_Required.fields.SDS_Language'],
                              searchDisplay: "AUTO",
                              validations: {}
                            ),
                            a!richTextDisplayField(
                              value: a!richTextIcon(
                                icon: "close",
                                link: a!dynamicLink(
                                saveInto : a!save(
                                  ri!AOS_Documents_Required,
                                  remove(ri!AOS_Documents_Required, fv!index)
                                )
                                ),
                                linkStyle: "STANDALONE",
                                color: "NEGATIVE"
                              )
                            )
                          }
                        )
                      ),
                      selectionSaveInto: {},
                      addRowLink: a!dynamicLink(
                        label: "Add new",
                        saveInto: ri!AOS_Documents_Required,
                        value: append(
                          ri!AOS_Documents_Required,
                          'recordType!AOS_Documents_Required'()
                        )
                      ),
                      validations: {},
                      shadeAlternateRows: true

13 replies

vinaykumarp8308
Participating Frequently
May 5, 2024

Hello [mention:65064d657301491bb67136887baaec4d:e9ed411860ed4f2ba0265705b8793d05] ,

Try differentiating the rows by an id while you click add row link.

And save the value in proper way.

value: 'recordType!AOS_Documents_Required'(

documentId: count(ri!AOS_Documents_Required) +1

),

saveInto: a!save(

ri!AOS_Documents_Required,

append(
                          ri!AOS_Documents_Required,
                          save!value
                        )

)

Refer the Editable Grid for reference.

May 5, 2024

After following what you suggested I got error in the expression:

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!dynamicLink [line 402]: Keys must be record field references or record relationship references

                    addRowLink: a!dynamicLink(
                        label: "Add new",
                        value: 'recordType!{c80b9de7-a15f-41db-8c92-5cb6b7aa7ce3}AOS_Documents_Required'(
                          DocumentID: count(ri!AOS_Documents_Required) +1
                        ),
                        saveInto: a!save(
                          ri!AOS_Documents_Required,
                          append(
                            ri!AOS_Documents_Required,
                            save!value
                          )
                        )
                      ),
                      validations: {},
                      shadeAlternateRows: true

stefanhelzle0001
Brainy
May 5, 2024

You need to change this snippet

value: 'recordType!AOS_Documents_Required'(

documentId: count(ri!AOS_Documents_Required) +1

),

according to the way how record fields are referenced.

https://docs.appian.com/suite/help/24.1/reference-records.html

something like this:

value: 'recordType!AOS_Documents_Required'(

'recordType!AOS_Documents_Required'.fields.'documentId': count(ri!AOS_Documents_Required) +1

),