Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
6 replies
Subscribers
8 subscribers
Views
3674 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Hi all, I am trying to set the 'sort' parameter 'pagingInfo' of
sikhivahans
over 11 years ago
Hi all, I am trying to set the 'sort' parameter 'pagingInfo' of query record with multiple fields. But I am getting the following error when trying to do so : "Expression evaluation error at function 'queryrecord': Error evaluating function 'queryrecord' : Cannot sort by multiple fields."
Here goes my configuration:
pagingInfo: 'type!PagingInfo'(
startIndex:1,
batchSize:-1,
sort:{{field:"firstName", ascending:true()},{field:"lastName", ascending:true()}}
)
Did I do any mistake in the configuration? Or do pagingInfo of queryrecord() doesn't accept sortinfo array? Bu the same 'sort' configuration worked fine when passed to a query rule. I am just curious to know why the same 'sort' configuration which worked fine when passed to query rule isn't working when passed to 'pagingInfo' in 'query' parameter of queryrecord().
Thanks in advance....
OriginalPostID-78481
OriginalPostID-78481
Discussion posts and replies are publicly visible
0
Sathya Srinivasan
Appian Employee
over 11 years ago
If I remember correctly, you can only sort by one field at a time.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 11 years ago
@sathya.srinivasan, but the document speaks that sort in pagingInfo is an array and it is working with a query rule.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
revat.anandsongkit
Appian Employee
over 11 years ago
@Sikhivahan - From the error message you mentioned, it seems like the error is in the way you have configured your queryrecord() expression. Could you write your expression? As for pagingInfo, you can provide more than one field to sort in.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Sathya Srinivasan
Appian Employee
over 11 years ago
Thanks Rikhi, I stand corrected.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 11 years ago
@revat.anandsongkit if I sort on one field,its working fine But issue is with multiple sort fields. My doubt here is whether queryrecord can accept multiple sort fields or not, because ultimately it is the paging info which will be passed to queryrecord and sort in paginginfo is an array.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
revat.anandsongkit
Appian Employee
over 11 years ago
Here is an approach you could try:
1) Collect your data using the queryrecord() function with one or no sort
2) Define a paging info using rule!APN_pagingInfo(sort: {{field: "field1", ascending: true}, {field: "field1", ascending:true}, ... }) which will allow you to pass in an array
3) todatasubset(local!data, local!pagingInfo)
4) use data from (3) to populate your grid/chart etc.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel