Could not display interface. Please check definition and inputs.Interface Definition: Expression evaluation error at function a!forEach [line 438]: Error in a!forEach() expression during iteration 3: Expression evaluation error at function a!dropdownField

Certified Senior Developer

Hi Everyone,

We have a editable grid where we placed 2 drop down values. Second dropdown choice values and choice labels purely dependent on first drop down selected value.But we are getting the error.

a!dropdownField(
                                    label: "Therapeutic Area",
                                    placeholder: "---Please Select---",
                                    choiceLabels: index(local!therapeuticArea, "name", {}),
                                    choiceValues: index(
                                      local!therapeuticArea,
                                      "therapeuticAreaId",
                                      {}
                                    ),
                                    value: fv!item.therapeuticAreaId,
                                    saveInto: {
                                      fv!item.therapeuticAreaId,
                                      a!save(fv!item.diseaseStateId, null),
                                      a!save(fv!item.studyGap1Id, null())
                                    },
                                    required: true(),
                                    validationGroup: cons!ISR_VALIDATION_GROUP_SUBMIT
                                  ),

a!dropdownField(
                                    label: "Evidence Category",
                                    labelPosition: "ABOVE",
                                    value: fv!item.studyGap1Id,
                                    choiceValues: index(
                                      rule!ISR_qry_GetStudyGap1ById(
                                        isActiv: true(),
                                        studyGap1Ids: rule!ISR_qry_GetStudyGap1ByTAIds(
                                          therapeuticIds: fv!item.therapeuticAreaId,
                                          diseaseStateIds: fv!item.diseaseStateId,
                                          fetchTotalCount: false()
                                        ),
                                        columns: { "name", "studyGap1Id" },
                                        returnDataSubset: false()
                                      ),
                                      "studyGap1Id",
                                      {}
                                    ),
                                    choiceLabels: index(
                                      rule!ISR_qry_GetStudyGap1ById(
                                        isActiv: true(),
                                        studyGap1Ids: rule!ISR_qry_GetStudyGap1ByTAIds(
                                          therapeuticIds: fv!item.therapeuticAreaId,
                                          diseaseStateIds: fv!item.diseaseStateId,
                                          fetchTotalCount: false()
                                        ),
                                        columns: { "name", "studyGap1Id" },
                                        returnDataSubset: false()
                                      ),
                                      "name",
                                      {}
                                    ),
                                    placeholder: "-- Please Select the value for Evidence Category",
                                    required: true(),
                                    disabled: if(fv!item.therapeuticAreaId, false, true),
                                    validationGroup: cons!ISR_VALIDATION_GROUP_SUBMIT,
                                    saveInto: {
                                      fv!item.studyGap1Id,
                                      a!save(
                                        fv!item.studyGap1Name,
                                        index(
                                          rule!ISR_qry_GetStudyGap1(StudyGap1Id: fv!item.studyGap1Id),
                                          "name",
                                          null
                                        )
                                      ),
                                      a!save(
                                        fv!item.evidenceCategory,
                                        index(
                                          rule!ISR_qry_GetStudyGap1(StudyGap1Id: fv!item.studyGap1Id),
                                          "name",
                                          null
                                        )
                                      )/

                                    },
                                     

                                  ),
 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Why are you running the query in `rule!ISR_qry_GetStudyGap1ById()` two separate times?  You should be querying into a local variable and then just accessing the value of that local variable in your dropdown.  This increases efficiency as well as code-readability, and makes it easier to debug in case something goes wrong with your query (instead of just experiencing an error from your dropdown trying to access wonky values).

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    I tried that, but as I said in the above its editable grid my drop down values will be completely dependent on the first drop down selection.so for each row i do have a separate choice values and labels 

    Ex:for the first row if we select "A" in the first drop down , second drop down will show "Ant","Animal","Air" etc

    like wise if we select B in the first drop down of second row , second drop down will show the "B" related values.

    So if I create a local variable it is showing common choice values for all the rows.But that is not our requirement

  • 0
    Certified Senior Developer
    in reply to sireesha

    Hi Sireesha,

    Initially you have to query all the data and store it in the local variable. 

    Example - Ant, Animal,Air etc...

    1) You have to create another one local variable with the name currentEvidenceCategory. Lets assume while select A in the  dropdown 1,In the save into you have to get all the A related value from the initial local variable and store it in currentEvidenceCategory

    2) In the Dropdown 2, you have to show this currentEvidenceCategory Choice value and Choice Lable

Reply
  • 0
    Certified Senior Developer
    in reply to sireesha

    Hi Sireesha,

    Initially you have to query all the data and store it in the local variable. 

    Example - Ant, Animal,Air etc...

    1) You have to create another one local variable with the name currentEvidenceCategory. Lets assume while select A in the  dropdown 1,In the save into you have to get all the A related value from the initial local variable and store it in currentEvidenceCategory

    2) In the Dropdown 2, you have to show this currentEvidenceCategory Choice value and Choice Lable

Children
No Data