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
2 replies
Subscribers
7 subscribers
Views
1380 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Hi Team, Any idea how to sort CDT array in script task. I have used r
madhankumarb
over 9 years ago
Hi Team,
Any idea how to sort CDT array in script task. I have used rule!APN_sortComplexTypes function. It was working fine in Appian 7.8 but in Appian7.9 it is giving below error,
Details: ERROR:An error occurred while evaluating expression: BAWRootCauseType:rule!APN_sortComplexTypes(pv!BAWRootCauseType,"Completed_Date",false) (Expression evaluation error in rule 'apn_sortcomplextypes' at function 'todatasubset' [line 6]: Error evaluating function 'todatasubset' : An invalid start index of 0 was passed in. Start indices must be greater or equal to 1.) (Data Outputs)
This is working fine without any issues in Appian 7.8
Any help.
Regards,
Madhankumar. B
OriginalPostID-155878
OriginalPostID-155878
Discussion posts and replies are publicly visible
Parents
0
sikhivahans
over 9 years ago
@madhankumarb You could use the todatasubset function as shown below:
To sort on a single field:
todatasubset(
\t
,
\ta!pagingInfo(
\ tstartIndex: 1,
\ tbatchSize: -1,
\ tsort: a!sortInfo(field: "field1",ascending: true())
\t)
).data
To sort on multiple fields:
todatasubset(
\t
,
\ta!pagingInfo(
\ tstartIndex: 1,
\ tbatchSize: -1,
\ tsort: {
\ ta!sortInfo(field: "field1",ascending: true())
\ t
\ t}
\t)
).data
Afaik the issue may not be with 7.9, but could be with the changes made in the dependent rules (of rule!APN_sortComplexTypes()) by any of your team members.
Assuming that the data hold by cdt variable is proper, I would like to recommend to check if the rule!APN_pagingInfo() (being used by rule!APN_sortComplexTypes()) is initializing the 'startIndex' to 1 when a null value is being passed to it.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
sikhivahans
over 9 years ago
@madhankumarb You could use the todatasubset function as shown below:
To sort on a single field:
todatasubset(
\t
,
\ta!pagingInfo(
\ tstartIndex: 1,
\ tbatchSize: -1,
\ tsort: a!sortInfo(field: "field1",ascending: true())
\t)
).data
To sort on multiple fields:
todatasubset(
\t
,
\ta!pagingInfo(
\ tstartIndex: 1,
\ tbatchSize: -1,
\ tsort: {
\ ta!sortInfo(field: "field1",ascending: true())
\ t
\ t}
\t)
).data
Afaik the issue may not be with 7.9, but could be with the changes made in the dependent rules (of rule!APN_sortComplexTypes()) by any of your team members.
Assuming that the data hold by cdt variable is proper, I would like to recommend to check if the rule!APN_pagingInfo() (being used by rule!APN_sortComplexTypes()) is initializing the 'startIndex' to 1 when a null value is being passed to it.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data