Question
Sorting not working on queried subobjects.
I have following code in my expression rule, its giving the data correctly but when i apply sorting it is working fine for all the other fields but for the fields: "Headlines" and "ArticlePostDate" it shows empty data, doesn't return any data. These two are the fields that are not part of the main table and i am referencing it from another table that could be the cause that its not showing any data when I apply sorting in them. Can anyone please help what to do in this scenario.
Thanks
a!localVariables(
local!sortField_txt: rule!EF_PlantDashboard_NewsPagingMapping(
sortField_txt: ri!pagingInfo_pi.sort.field
),
local!oDataQuery_txt: concat(
"/Internal/Editable/ABC?editable=true&includeDeleted=true&$expand=Article($select=ArticlePostDate,Headline)&$filter=Key+eq+",
ri!Key,
"&$count=true&$top=",
cons!EF_PLANTDASHBOARD_NEWS_PAGESIZE,
"&$skip=",
ri!pagingInfo_pi.startIndex - 1,
"&$orderby=",
local!sortField_txt,
if(
ri!pagingInfo_pi.sort.ascending,
"+asc",
"+desc"
)
),
local!integrationResponse_at: rule!IntOData_GetRequest(
oDataQuery_txt: local!oDataQuery_txt
),
local!isSuccess_bl: rule!OData_IsRequestSuccessful(
integrationResponse_at: local!integrationResponse_at
),
local!rawData_at: rule!OData_ExtractResponse(
integrationResponse_at: local!integrationResponse_at,
isSuccess_bl: local!isSuccess_bl
),
local!count_int: rule!OData_GetTotalCount(
integrationResponse_at: local!integrationResponse_at,
isSuccess_bl: local!isSuccess_bl
),
local!dataset_map: if(
local!isSuccess_bl,
a!forEach(
items: local!rawData_at,
expression: a!map(
KeyArticles: fv!item.KeyArticles,
KeyDoc: fv!item.KeyDoc,
Key: fv!item.Key,
Headline: cast(typeof("a"), index(fv!item.Article, "Headline", {})),
ArticlePostDate: cast(typeof(now()), index(fv!item.Article, "ArticlePostDate", {})),
UpdOperation: fv!item.UpdOperation,
UpdOperationLabel: if(
tointeger(fv!item.UpdOperation) = 0,
"New",
if(
tointeger(fv!item.UpdOperation) = 1,
"Updated",
"Deleted"
)
),
UpdDate: fv!item.UpdDate,
AppStatus: fv!item.AppStatus,
AppStatusLabel: if(
tointeger(fv!item.AppStatus) = 2,
"Approved",
"Not Approved"
)
)
),
{}
),
a!dataSubset(
startIndex: ri!pagingInfo_pi.startIndex,
batchSize: ri!pagingInfo_pi.batchSize,
sort: ri!pagingInfo_pi.sort,
totalCount: local!count_int,
data: local!dataset_map,
identifiers: index(local!dataset_map, "KeyArticles", {})
)
)
