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
20 replies
Subscribers
9 subscribers
Views
4203 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Hi I have a scenario wherein I am displaying data in my drop down by
komalc3
A Score Level 1
over 9 years ago
Hi
I have a scenario wherein I am displaying data in my drop down by fetching the values from DB via. query rule or query entity. Now I want to display data in the drop down in a sorted form and I am not using sorting in my query rule or the a!sortInfo in the paginInfo of my a!query entity. Is there a way I can do it?
Thanks in advance.
OriginalPostID-208782
OriginalPostID-208782
Discussion posts and replies are publicly visible
0
Stefan Helzle
A Score Level 3
over 9 years ago
I know there is a lot of internal non-public functions which is OK for me, but sort() ? BTW wherecontains is documented, at least in 16.1.
forum.appian.com/.../Array_Functions.html
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 9 years ago
@stefanh Hmm, the reason why I compared it with wherecontains() is, some time ago, even wherecontains() is a hidden function and it's exposed after some time. sort() is also hidden as of now (similar to wherecontains() behavior some time ago) and might be exposed down the line as Appian did in case of wherecontains().
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
komalc3
A Score Level 1
over 9 years ago
Thank you sikhivahans, stefanh791 for your replies.
stefanh791 in the earlier comment you mentioned you tried something with ad hoc data structure, can you please elaborate what you actually did.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 9 years ago
Sure. In this case I wanted to sort users without using the plugin. But this can be used for anything where you cannot sort using the actual value but have to sort by something else. My expression is
TS_ToSortDict(itemToSort: any, itemSortBy: any)
={item: ri!itemToSort, sort: ri!itemSortBy}
Then it can be used like this:
=todatasubset(
arrayToPage: apply(rule!DMP_ToSortDict(
item:_,
sort:_
), merge(ri!users, apply(rule!APN_displayUser(user:_), ri!users))),
pagingConfiguration: a!pagingInfo(1, -1, a!sortInfo("sort", true))
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
komalc3
A Score Level 1
over 9 years ago
stefanh791 thank you for replying!!
Can you please explain what are you trying to do in a!sortInfo(). As far as I understood your rule, you are sending in the sub rule's attribute item an array which is a combination of user names and user display names and then for itemSortBy attribute, you are sending a!pagingInfo where I am not able to understand the significance of "sort" in a!sortInfo.
Can you please explain!!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 9 years ago
sort in sortInfo is just the name of the field in the data structure I want to use for sorting. The apply() expression creates a structure something like this.
{{item: "a", sort: 2}, {item: "b", sort: 1}}
Then I tell sortinfo to sort this by the "sort" field.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
komalc3
A Score Level 1
over 9 years ago
stefanh791 there is still some confusion from my end.
Please correct me if I am wrong:
With
merge(ri!users, apply(rule!APN_displayUser(user:_), ri!users))
You are creating an array which is a combination of usernames and user display
names.
This array is what goes to the sub rule's item attribute. Then from where is sort attribute getting value from on which a!sortInfo() is working?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 9 years ago
This array goes to the items AND to the sort attribute. Merge() interleaves both arrays and creates pairs of values which apply uses to call the expression.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
komalc3
A Score Level 1
over 9 years ago
stefanh791 thank you for explaining!!
I get your point of how this array is passed to the sub rule.
So the core of this is a!sortInfo() is the only way out even if we use the adhoc data structure thing that you have explained above!!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 9 years ago
It depends a bit on what you want to do and whether you want to use the "hidden" sort() function. Maybe someone else has a better idea, but this is what I did after some investigation.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
<