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
7 replies
Subscribers
7 subscribers
Views
3436 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
CustomPickerField
ankitab918
over 8 years ago
I am using a custom picker field in an editable grid. This picker field is being called in a loop and only the last row when clicked on add item is editable, rest all the other rows are read only field. Now in the last row of the picker field suggestion, I want to eliminate all those values that are already entered in the above rows that are non editable. How do I achieve that?
OriginalPostID-245300
Discussion posts and replies are publicly visible
0
PhilB
A Score Level 1
over 8 years ago
Depending on the data, you can use filter(), reject() or a combination of wherecontains() and remove() to achieve this.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sridevik7401
Certified Lead Developer
over 8 years ago
@ankitab918....As above practitioner suggested Use filter() or wherecontains() to eliminate the values that are already entered..
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
omere
over 8 years ago
you can pass a variable into your gridRowLayout() rule which holds the highest index value. For the picker field component, you can make it disabled if the current value [index] <> highest index value. This will disabled all rows except the last
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ankitab918
over 8 years ago
Thanks for all the suggestion. Instead of eliminating the values from the suggestion, I want a validation error. I am using the below code to achieve that. The validation is working fine for the last row, however, it is validating against all the above rows as well. Please refer the attachment for the UI.
validations:if(any(rule!CP_MatchAnyExistingDoc(_,ri!document[ri!index]),apply(index(ri!document,_),1+enumerate(count(ri!document)-1))),
"This document already exist for the claim. Duplicates not allowed","")
---rule!CP_MatchAnyExistingDoc-----
if(
ri!existingDoc.Document.DocName=ri!newDoc.Document.DocName,true,false()
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ankitab918
over 8 years ago
I replaced the above code with the below one. Instead of ri!index, I used count(ri!document) as index to get the last row. It seems to do the trick. However, the validation message is showing on all rows.
if(any(rule!CP_MatchAnyExistingDoc(_,ri!document[count(ri!document)]),apply(index(ri!document,_),1+enumerate(count(ri!document)-1))),
"This document already exist for the claim. Duplicates not allowed","")
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 8 years ago
@ankitab Apply the validation only in the case of editable rows or skip the validation in case of read only rows. I guess you can use the same logic which you have applied for making a row read only or editable and then control the validations based on the same.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ankitab918
over 8 years ago
Hi sikhivahans, It worked. Thanks :)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel