Hi I have a scenario wherein I am displaying data in my drop down by

Hi

I have a scenario wherein I am displaying data in my drop down by fetching the values from DB via. query rule or query entity. Now I want to display data in the drop down in a sorted form and I am not using sorting in my query rule or the a!sortInfo in the paginInfo of my a!query entity. Is there a way I can do it?


Thanks in advance.

OriginalPostID-208782

OriginalPostID-208782

  Discussion posts and replies are publicly visible

Parents
  • Go through below example, Using todatasubset() , a!pagingInfo() we can sort the query result.
    load(
    local!cdt_queryData:{
    {name:"CBC",id:1},{name:"DBA",id:2},{name:"ABC",id:3},{name:"BBC",id:4}
    },
    local!sortedData:fn!todataSubset(local!cdt_queryData,a!pagingInfo(startIndex:1,batchSize:-1,sort:a!sortInfo(field:"name",ascending:true))),
    a!dropdownField(
    choiceLabels:index(local!sortedData.data,"name",{}),
    choiceValues:index(local!sortedData.data,"id",{}),
    placeholderLabel:"Select"
    )
    )
Reply
  • Go through below example, Using todatasubset() , a!pagingInfo() we can sort the query result.
    load(
    local!cdt_queryData:{
    {name:"CBC",id:1},{name:"DBA",id:2},{name:"ABC",id:3},{name:"BBC",id:4}
    },
    local!sortedData:fn!todataSubset(local!cdt_queryData,a!pagingInfo(startIndex:1,batchSize:-1,sort:a!sortInfo(field:"name",ascending:true))),
    a!dropdownField(
    choiceLabels:index(local!sortedData.data,"name",{}),
    choiceValues:index(local!sortedData.data,"id",{}),
    placeholderLabel:"Select"
    )
    )
Children
No Data