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
4 replies
Subscribers
7 subscribers
Views
1874 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Can below code be optimized further or written without load()? =load(
praveenj
over 9 years ago
Can below code be optimized further or written without load()?
=load(
/* ri!savedValue is a Text type */
local!tempLocalVariable: if(rule!APN_isBlank(ri!savedValue), {}, split(ri!savedValue, ";")),
a!checkboxField(
label: "Sample Checkbox",
choiceLabels: {"a1","b2"},
choiceValues: {"a1","b2"},
value: local!tempLocalVariable,
saveInto: ri!savedValue
)
)
PS: ri!savedValue cannot be changed to multi value text.
Thanks,
Praveen
OriginalPostID-140016
OriginalPostID-140016
Discussion posts and replies are publicly visible
0
chase.putnam
over 9 years ago
Load is needed when any local variables are instantiated on the first rendering of the SAIL interface.
See:
forum.appian.com/.../SAIL_Design.html
under the section on the load() function.
The value and saveInto objects need to be multiple for the checkboxField.
See:
forum.appian.com/.../SAIL_Components.html
where the value and saveInto parameters explicitly detail then need to be able to save multiple values.
You should implement a radioButtonField for a field where only one choice is valid to be saved.
forum.appian.com/.../SAIL_Components.html
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
praveenj
over 9 years ago
Hi Chase,
Thanks for replying. I'm aware of all three points which are pretty valid. In my scenario the field I need to save into is not a multival but a singleval text type and I need to save/read multiple values in/from it. Hence the above workaround.
Below is the alternative code (which I prefer) but it fails with an error. Hence thought I would ask in here if anyone had done similar thing before.
a!checkboxField(
label: "Sample Checkbox",
choiceLabels: {"a1","b2"},
choiceValues: {"a1","b2"},
value: if(rule!APN_isBlank(ri!savedValue), {}, split(ri!savedValue, ";")),
saveInto: ri!savedValue
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
best
Certified Lead Developer
over 9 years ago
Try this:-
a!checkboxField(
label: "Sample Checkbox",
choiceLabels: {"a1","b2"},
choiceValues: {"a1","b2"},
value: if(rule!APN_isBlank(ri!savedValue), {}, apply(fn!trim,split(ri!savedValue, ";"))),
saveInto: ri!savedValue
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
praveenj
over 9 years ago
Cool, thank you. trim() is what I was missing as there is a space added in between the array elements along with the ";".
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel