multi dropdown in a grid

The below code is throwing the above error. Please advise a correct way of doing this. using a dropdown column in a Grid. Grid rows are in a foreach loop and dropdown saveinto has another nested foreach loop and how to map the rights values to be able to change the preselected values and save.

rows: a!forEach(
          items: local!sources,
          expression: {
            a!gridRowLayout(
              id: fv!index,
              contents: {
                a!textField(
                  value: local!sources[fv!index].DisplayName,
                  saveInto: local!sources[fv!index].DisplayName,
                  refreshafter: "UNFOCUS"
                ),
                a!textField(
                  value: local!sources[fv!index].FullName,
                  saveInto: local!sources[fv!index].FullName,
                  refreshafter: "UNFOCUS"
                ),
                a!textField(
                  value: local!sources[fv!index].Description,
                  saveInto: local!sources[fv!index].Description,
                  refreshafter: "UNFOCUS"
                ),
                a!multipleDropdownField(
                  label: "",
                  choiceLabels: local!sources[fv!index].Technologies.Name,
                  choiceValues: local!sources[fv!index].Technologies.Id,
                  value: { local!sources[fv!index].Technologies.Id },
                  saveInto:                         a!save(
                          local!sources[fv!index].Technologies,
                          a!forEach(
                            items: save!value,
                            expression: {
                              Id: fv!index,
                              DisplayValue: displayvalue(
                                fv!index,
                                local!sources[fv!item].Technologies.Id,
                                local!sources[fv!item].Technologies.Name,
                                null
                              )
                            }
                          )
                        )
                ),

  Discussion posts and replies are publicly visible

Parents
  • : Can you please provide an Error Message , We are not able to see exact error text in attached image.

    Thanks!!
  • Scenario:

    Display Preselected multiple values in multi drop down coming from Database. Allow user to change these values and save in DB which is when the below error is coming. It is also coming when I am trying to add new record in Editable Grid at same field.

     

    Error Message:

    Could not display interface. Please check definition and inputs.
    Interface Definition: Expression evaluation error at function a!forEach [line 49]: Error in a!forEach() expression during iteration 4: Expression evaluation error at function a!multipleDropdownField [line 74]: Invalid index: Cannot index property 'Id' of type Text into null value of type Technologies?list

  • 0
    Certified Senior Developer
    in reply to anushas0002
    this error displays because
    local!sources[fv!item].Technologies value is null

    you can use
    index(local!sources[fv!item].Technologies,"Id","") instead local!sources[fv!item].Technologies.Id

    try commenting dropdown field
    and then display value of local!sources in any test field
    you will be able to find issue

    if you can share value of local!sources that will be helpful to understand the issue
  • unfortunately it didn't work still. Please see the below screenshot may be it helps understand the issue better.

     

  • 0
    Certified Senior Developer
    in reply to anushas0002
    could you share value of local!sources ?
  • There are two tables sources and technologies with many to many relationship. Therefore, Each Source has more than one technologies in this grid which needs to be shown as preselected values. sample data is below but its lengthy. Please refer to the above another screenshot which shows error message on Editable Grid when tried to click on "Add New Source(s)" link and it is same error when I try to change the preselected values in multi dropdown.

     



    Sources
    Id: 2
    DisplayName: "Artificial Intelligence"
    FullName: "Artificial Intelligence"
    Description: "Artificial Intelligence"
    Technologies: List of Technologies: 2 items
    Technologies
    Id: 18
    Name: "Quantum Computing"
    Definition: null (Text)
    Description: null (Text)
    YearsToImpact: 10
    ScaleOfImpact: "High"
    AnalystReports: null (Text)
    AssetsAndAccelerators: null (Text)
    Standards: null (Text)
    Enablers: null (Text)
    UserCases: null (List of UseCases)
    RisksAndControls: null (List of RisksOrControls)
    CaseStudies: null (Text)
    GlobalCapabilities: null (List of Capabilities)
    Industry: null (Text)
    Vendor: null (Text)
    TeamSize: null (Number (Integer))
    OpportunityRating: 5
    RiskRating: 4
    Source: List of Sources: 1 item
    null (Sources)
    Images: List of Images: 2 items
    Images
    Id: 4
    Title: "QC_1"
    Label: "Flagships, Connected Enterprise, AI, Machine Learning, Cryptography, Encrytion, Pattern Matching"
    DocumentId: 17064
    ContentUrl: null (Text)
    Industry: null (Text)
    Source: null (Sources)
    Images
    Id: 5
    Title: "QC_2"
    Label: "Flagships, Connected Enterprise, AI, Machine Learning, Cryptography, Encrytion, Pattern Matching"
    DocumentId: 17065
    ContentUrl: null (Text)
    Industry: null (Text)
    Source: null (Sources)

  • 0
    Certified Senior Developer
    in reply to anushas0002
    Are you getting data from service ?
    because Appian do not support multiple to multiple

    you can try
    comment code and pass rows as rows:{}
    take another textField(label:debug, value: local!sources ) to display local!sources value in your interface.

    then check loacal!sources value and share it.
  • service is fine and showing the dropdown and values in another form correctly where there is no editable grid and just form with multidropdown. It is not working inside EditableGrid.
Reply Children
No Data