getting error while using sort

Hello Team,

I have a below code to display value,count and email on a grid. Value is coming from an internal rule, and count is coming from db after comparing it with value.

I have another rule to bring email , which is getting that from internal group but when I am trying to have sort in place for count getting bellow error

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function 'todatasubset' [line 32]: The given data type is not a complex type: TypedValue[it=3,v=abc@appian.com]

load(
local!pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 10,
sort: a!sortInfo(
field: "count",
ascending: false
)
),
with(
local!gpusername: touniformstring(rule!getUserNamesFromGroup(groupid)),
local!dbusername: touniformstring(rule!test_rule()),
local!email: touniformstring(rule!getEmailFromGroup(groupid)),
local!rule1: local!gpusername,
local!rule2: local!dbusername,
local!data: a!forEach(
items: local!rule1,
expression: {
value: fv!item,
count: count(
wherecontains(
fv!item,
local!rule2
)
)
}
),
local!dataSubSet: todatasubset(
local!data,
local!pagingInfo
),
local!dataSubSetEM:todatasubset(local!email , local!pagingInfo)
a!formLayout(
contents: {
a!gridField(
label: "",
totalCount: local!dataSubSetEM.totalCount,
columns: {
a!gridTextColumn(
label: "Value",
data: index(
local!dataSubSet.data,
"value",
{}
)
),
a!gridTextColumn(
label: "Count",
field: "count",
data: index(
local!dataSubSet.data,
"count",
{}
)
),
a!gridTextColumn(
label: "Email",
field: "email",
data: local!dataSubSetEM.data

)
},
value: local!pagingInfo,
saveInto: local!pagingInfo
),
a!paragraphField(
value: sum(index(
local!dataSubSet.data,
"count",
{}
))
)
}
)
)
)

  Discussion posts and replies are publicly visible

Parents
  • gauravp0003, 

    That sort function will work only for complex type (i.e CDT or Dictionary type). Here your trying to create datasubset for string array which doesn't contain a field called "count".

    Your using two datasubsets to show the data in the grid it will give you error if the total counts are different. You can create a rule which takes this data as input and returns a dictionary type like below. so that you can perform the sort functionality also.

    {

    email: "abc@abc.com",

    value: "value",

    count: 2

    }

Reply
  • gauravp0003, 

    That sort function will work only for complex type (i.e CDT or Dictionary type). Here your trying to create datasubset for string array which doesn't contain a field called "count".

    Your using two datasubsets to show the data in the grid it will give you error if the total counts are different. You can create a rule which takes this data as input and returns a dictionary type like below. so that you can perform the sort functionality also.

    {

    email: "abc@abc.com",

    value: "value",

    count: 2

    }

Children
No Data