Hi Team,
I have a dropdown field in which once user selects the value, based on it the grid below displays the result.
a!dropdownField( label: "", labelPosition: "", placeholder: "Years Available", choiceLabels: local!years, choiceValues: local!years, value: local!selectedYear, saveInto: { local!selectedYear, a!save(ri!selectedYear, local!selectedYear), a!save(local!GridData, wherecontains(tointeger(local!selectedYear), tointeger(index(ri!engagement,"clientYearEnd",null()))) ),a!save(local!selectedIndex, null), a!save(ri!selectedEngagements, null), a!save(local!data, null) } )
The local!GridData is used in the data parameter of the gridField but here it is not getting any value. Can anyone please suggest what needs to be done?
Thanks
Discussion posts and replies are publicly visible
Hello ananditab,1.) is ri!engagement null or empty?2.)is the value selectYear within the array of "client years"?
What is the intended output? wherecontains() gives you the indexes of values in a list.
valid point. local!Griddata shouln't be an index usually
Additionally, I wouldn't recommend "hardcoding" (as it were) the desired output value of a filter into its SaveInto. That logic should be handled dynamically in the relevant Local Variables (and/or queries).
The desired output is a list of engagements which has the selectedYear from the dropdown.
1.) ri!engagement is not empty. Its holds a dictionary.
2.) yes the value is within the array of "client years"
What is the expected value of local!GridData prior to a value being selected from the dropdown? Would it contain all values in ri!engatement, or just be empty?
As Stefan already noted, the result of the whereContains() function simply returns a list of indices. If you want to use that to actually pull data from those indices in an exisitng list, you can pair this with the index() function. I would still suggest doing this within the declaration of local!GridData instead of manually setting it in a SaveInto of a dropdown, though.
If you could post a small sample of example code, something which any of us could copy and paste into a blank interface editor without needing your specific CDTs or Rule Inputs, we'd be able to help a lot more easily. If you do, please utilize the "Code Box" functionality: Insert --> Insert Code in the comment menu.