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
For this we will need to know what your choiceLabels and choiceValues evaluate to. I would debug by doing something such as, commenting out the dropdownField and adding a textField in it's place temporarily with these values.
choice values will have ids and choice labels will have names from the database
Hi sireesha looks like your usecase is cascading dropdown You can find example in this interface recipes: Configure Cascading Dropdowns - Appian 25.1
And what error are you facing?
Hi Yashwanth,
I am getting this error:
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 [line 482]: A dropdown component [label="Evidence Category"] has an invalid value for "choiceValues". The choiceLabels and choiceValues arrays must be the same length, but choiceLabels was length 0 and choiceValues was length 67.
Can you check design_errors.csv it will log more about your error (With the above details we couldn't understand what's the exact error was ). Just like Chris mentioned above try debugging from root level (For example try passing values to second dropdown directly to see how it behaves)
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).
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
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
sireesha said: but choiceLabels was length 0 and choiceValues was length 67.
The error clearly mentioned where it went wrong, try evaluating your query in second dropdown , check whether it's returning name values are not.
sireesha said:So if I create a local variable it is showing common choice values for all the rows.But that is not our requirement
Then your local variable is scoped wrong. You could create a local variable relevant to the particular row, to store the entire query (still reducing 2 query calls to 1 call). This is even more important since it seems you're calling that query 2x per row instead of just 2x on the form overall.