Hi All,
I am having a list of months shuffled in a list. I want to arrange them in their chronological order. But I can sort only on alphabetical order. Help me guys.
local!months:{"June","January","March","Novemeber","February","October","December","April","July","May","September","August"}, sort(local!months).
Thank you
Discussion posts and replies are publicly visible
What sort of flexibility do you have? Can you make your local variable, instead of holding a list of string, hold a list of dictionary/maps instead, in which you give each month a "name" and a "number" parameter?
a!localVariables( local!data_cdt: { { monthId: 1, Month: "Jan" }, { monthId: 2, Month: "Feb" }, { monthId: 4, Month: "Apr" }, { monthId: 3, Month: "Mar" } }, todatasubset( local!data_cdt, a!pagingInfo( 1, - 1, a!sortInfo(field: "monthId", ascending: true()) ) ))
Thanks for your reply gayatri, Can we sort it without using id values?
may be you can alter like this
a!localVariables( local!months: { "Jan", "Feb", "Apr", "Mar" },/*input*/ local!months_txt: { "Jan", "Feb", "Mar", "Apr" }, /*Constant*/ local!monthIds_int: { 1, 2, 3, 4 }, /*Constant*/ local!data_cdt: a!forEach( items: local!months, expression: a!map( monthId: displayvalue( fv!item, local!months_txt, local!monthIds_int, "" ), monthName: fv!item ) ), todatasubset( local!data_cdt, a!pagingInfo( 1, - 1, a!sortInfo(field: "monthId", ascending: true()) ) ).data.monthName )