Alternative of todatasubset on portals

Certified Lead Developer

Hi All,

Portals partially support todatasubset() function by using integration/web API as per documentation. Is there any other alternative to this as I want to apply sorting as well on the data but without calling any integration? I tried using a!datasubset but sorting is not working in this case and we need sorting as well on the data? Any suggestions ?

a!localVariables(
local!data: {
{ name: "b", position: 2 },
{ name: "a", position: 1 },
{ name: "d", position: 4 },
{ name: "c", position: 3 }
},
local!testDataSubset: a!dataSubset(
startIndex: 1,
batchSize: 4,
sort: a!sortInfo(field: "name", ascending: true()),
totalCount: 10,
data: local!data,
identifiers: local!data.position
),
local!testToDataSubset: todatasubset(
arrayToPage: local!data,
pagingConfiguration: a!pagingInfo(
startIndex: 1,
batchSize: - 1,
sort: a!sortInfo(field: "name", ascending: true())
)
),
local!testToDataSubset
)

Thanks.

Hitesh

  Discussion posts and replies are publicly visible

Parents
  • Where are you getting your data from? If it is coming from the records, then you can simply pass your sorting in the queryRecordType's pagingInfo. 

    If you building this data, you have 3 ways of doing this. 

    1. Plugin (isn't supported by Portals)
    2. todatasubset (via integration)
    3. sort() (this is an undocumented function and hence I do not recommend using it at all)

    I am not aware of any other way so you are only left with what you are doing right now if you are building this data on the portal. Otherwise, if it coming from the DB, add the sorting in the query itself. 

Reply
  • Where are you getting your data from? If it is coming from the records, then you can simply pass your sorting in the queryRecordType's pagingInfo. 

    If you building this data, you have 3 ways of doing this. 

    1. Plugin (isn't supported by Portals)
    2. todatasubset (via integration)
    3. sort() (this is an undocumented function and hence I do not recommend using it at all)

    I am not aware of any other way so you are only left with what you are doing right now if you are building this data on the portal. Otherwise, if it coming from the DB, add the sorting in the query itself. 

Children
No Data