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
7 subscribers
Views
2809 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
I have a SAIL form with a dropdown field which works fine except when a value is
smcgill
over 9 years ago
I have a SAIL form with a dropdown field which works fine except when a value is defaulted in and the user then selects the placeholder. As the placeholder doesn't have an index position it causes an "ArrayIndexOutOfBoundsException" on the save.
I have tried various configurations with the save but have been unable to come up with one that works :
....
a!dropdownFieldByIndex(
label: "Member supplier",
instructions: "Value saved: " & ri!newMemberDetails.supplier,
choiceLabels: local!supplierList.supplier,
placeholderLabel: "--- Select a New Member ---",
value: if(
rule!APN_isBlank(ri!newMemberDetails.supplier),
{},
whereContains(ri!newMemberDetails.supplier, local!supplierList.supplier)
),
...
OriginalPostID-150635
OriginalPostID-150635
Discussion posts and replies are publicly visible
0
smcgill
over 9 years ago
... saveInto: {
a!save(ri!newMemberDetails.supplier, local!supplierList.supplier[save!value]),
a!save(ri!newMemberDetails.supplierId, local!supplierList.supplierId[save!value]),
a!save(ri!newMemberDetails.supplierListMemberID, local!supplierList.supplierListMemberID[save!value]),
a!save(ri!newMemberDetails.postcodeArea,ri!postcodeArea ),
a!save(ri!newMemberDetails.suppliertype, "Member")
}, ....
Thanks in advance
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Conor Cahill
Certified Lead Developer
over 9 years ago
so you can make the placeholder label a conditional:
placeholderLabel: if(rule!APN_isBlank(ri!newMemberDetails.supplier),"","--- Select a New Member ---")
This will get rid of the placeholderLabel once there is a value for the dropdown.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Conor Cahill
Certified Lead Developer
over 9 years ago
err, switch the 2nd and 3rd arguments of the if statement.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Tim
Certified Lead Developer
over 9 years ago
I think your saves will be failing because save!value won't contain a valid index, switch your saves to either test save!value for null or use the index() function e.g.
a!save(ri!newMemberDetails.supplier, index(local!supplierList.supplier, save!value, {}))
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
smcgill
over 9 years ago
Hi conorc, thanks for the suggestion, I had tried that but it didn't appear to make any difference to the problem.
Hi Tim, I did try using the APN_isBlank but I haven't tried the index method. I'll give that a go next.
Thank you both
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
smcgill
over 9 years ago
Thank you the index suggestion works perfectly
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel