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
19 replies
Subscribers
7 subscribers
Views
7212 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
How do I save multiple selections in a checkboxField? I tried displaying the cho
judym598
Certified Senior Developer
over 8 years ago
How do I save multiple selections in a checkboxField? I tried displaying the choiceValues using a rule (e.g., rule!psh_getAllFruits) that pulled data from a cdt (PSH_Fruits). The CDT is associated with a table (pshfruits) that has 2 columns: id (auto-generated integer) and fruitType (text). I wanted to store the selected id(s) in a field in another CDT (specifically newList_cdt.fruitType). I originally had 'fruit' as an integer. When that didn't work, I decided to change my approach to displaying the choiceValues using a constant (cons!PSH_FRUITS) and using a checkboxFieldByIndex; couldn't get that to work, so I went with the following and changed the data type of the column in the table (and CDT for this item) to 'text'. It works as long as I only select one item. (I actually have 8 choices so I'd really prefer to pull the choiceValues from a CDT - lookup table). I cannot get it to save or display multiple selections. At one point...
OriginalPostID-192632
OriginalPostID-192632
Discussion posts and replies are publicly visible
0
narasimhaadityac
A Score Level 2
over 8 years ago
@jack, agreed, ideally, if we are having the reference data updates, we will not be removing the old reference ids, as they might be referenced once, so generally what we do is to have a active_in flag which will provide the details related to the validity of the choice value. please refer to - /search?q=OriginalPostID-183051
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
judym598
Certified Senior Developer
over 8 years ago
Thank you both for your suggestions and all the info provided. I would much rather pull the choiceValues from a lookup table (CDT). Can you confirm for me that the only way to capture multiple selections would be to use a nested CDT?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jackm829
A Score Level 3
over 8 years ago
@nara, Your code previously suggested splitting the string and comparing to: choiceValues: {"B", "A", "P", "G"}. I think this approach would have the drawback I describe (name changes of "B" to "BN" and such). However, if you are suggesting storing the ID in a delimited fashion (i.e. 1;2;3;4), then yes I think that would be immune to name changes. In this case, we likely would not be able to use foreign keys, and this may have some effect on querying, though using various query filters there may be workarounds.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jackm829
A Score Level 3
over 8 years ago
Personally, I would avoid nested CDTs, but that's just me.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
narasimhaadityac
A Score Level 2
over 8 years ago
@judy, I second Jack on nested CDT's, nested CDT's are performance intrinsic and Appian as well recommends to avoid them. in the Appian health check they are found as memory consumption objects. as per my knowledge using Nested CDT's we can achieve. but its a trade off to decide to store in same table or go for nested CDTs.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
judym598
Certified Senior Developer
over 8 years ago
I could store the id (1, 2, 3, 4...vs a letter) which is how I had it originally (I actually changed the example to 'fruit' because the actual item was 'datatype' and didn't want to confuse the issue!). In any case - when I tested it using the 'split' approach, I got an error? If I can do it that way - any idea why I got the error I got?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
narasimhaadityac
A Score Level 2
over 8 years ago
@judy, in my example, ri!fruitType is Text (single and not multiple).
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
narasimhaadityac
A Score Level 2
over 8 years ago
there is a space after the semicolon in split(ri!fruitType,"; ")
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
judym598
Certified Senior Developer
over 8 years ago
Thank you @narasimhaadityac! That space after the semicolon is what was causing the error!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
<