You are viewing limited content. For full access, please sign in.

Question

Question

IF statement for multiple checkboxes being checked

asked on April 30

Example, I have this:

 

I need the New Access List to be Adrian, Marshall so I have , in between for uploading to our SQL database.  I want to be able to write it so I have all the possible combinations they could choose to then fill that New Access List field so what get's written to SQL is formatted properly.  

0 0

Replies

replied on April 30

It would be much easier to do this in the workflow that I assume is inserting to SQL rather than using formulas in the form.

1 0
replied on April 30

I agree with Kevin, if you are only trying to store this in SQL, then it would be better to use WF and either store each selected user as a row with the insert activity or use tokens to add them into separate columns in the same row. 

0 0
replied on April 30

Just a note, I'm trying to make it say "Adrian" if just Adrian is checked, and Adrian, Marshall if Adrian and Marshall are checked.   I found another post where the code included made it read like Adrian Adrian,Marshall if Adrian and Marshall were checked

0 0
replied on April 30 Show version history

Do you need the list to show on the form itself, during that process step?

If you're able to add an intermediate step, there is the option to set the default value of your field to <list of all checked>. You can also assign metadata in the same way in a Save to Repository task. This would add the commas and cover any potential combination of options, without writing a huge IF statement.

 

Editing to add: 

If you're wanting to write it out as an IF statement, you can do so using something like this:

=CONCATENATE(IF(Checkbox.Choice_1,"Choice 1, ",""),IF(Checkbox.Choice_2,"Choice 2, ",""), IF(Checkbox.Choice_3, "Choice 3, ",""))

 

Editing again (sorry!):

I realized that left a ", " at the end, so here's an updated formula to remove that:

=LEFT(CONCATENATE(IF(Checkbox.Choice_1,"Choice 1, ",""),IF(Checkbox.Choice_2,"Choice 2, ",""), IF(Checkbox.Choice_3, "Choice 3, ","")),LEN(CONCATENATE(IF(Checkbox.Choice_1,"Choice 1, ",""),IF(Checkbox.Choice_2,"Choice 2, ",""), IF(Checkbox.Choice_3, "Choice 3, ","")))-2)

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.