Hi ,
I have added working code and non working code.
I am trying to sort by paging info which i added in non-working code which i need to fix. I am sharing working code also where i am not doing any sorting on year which need to be required.
------------------Non Working Code after adding below code **local!subMAS_dataset: todatasubset(local!subDataset, a!pagingInfo(startIndex: 1,batchSize: - 1,sort:{{field: "year",ascending: false** ---Code Start--- local!subDataset: rule!MAS_dataset( local!id, "details" ).data, local!subMAS_dataset: todatasubset( { local!subDataset, a!pagingInfo( startIndex: 1, batchSize: - 1, sort: { { field: "year", ascending: false } } ) } ), local!years: reject( fn!isNull, union( local!subMAS_dataset.year, local!subMAS_dataset.year ) ), ----ERROR----- Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function 'union' parameter 2 [line 100]: Invalid index: Cannot index property 'year' of type Text into type DataSubset ----Code End----- ------Working code without sorting year------ ----Code Start----- local!subDataset: rule!MAS_dataset( local!id, "details" ).data, local!years: reject( fn!isNull, union( local!subDataset.year, local!subDataset.year ) ), "NO ERROR" ----Code End-----
May i know the reason and how to fix that . Please help me on that.
ERROR- Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function 'union' parameter 2 [line 100]: Invalid index: Cannot index property 'cycleYear' of type Text into type DataSubset
Discussion posts and replies are publicly visible
Hi Saurav,
local!subMAS_dataset: todatasubset( { local!subDataset, a!pagingInfo( startIndex: 1, batchSize: - 1, sort: { { field: "year", ascending: false } } ) } )
The curly braces highlighted in red are not required as local!subDataset is already a dictionary/array. Also to define sort attribute, a!sortInfo() should be used.
Please refer https://docs.appian.com/suite/help/18.3/fnc_scripting_todatasubset.html for more info.
Hope it helps!!!
Thanks,
Hema