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

Question

Question

Forms: How can we remove underscores from checkbox values? The definitive solution please.

asked on December 19, 2019

Hey team, got an interesting challenge and I'm trying to find the cleanest way to manage it.

Essentially we have a process where users select multiple checkbox options..

As you can see above, using a checkbox element forces you to set values. They will be automatically set for you if you don't. Those values automatically replace "spaces" with underscores.

The issue is that when you go to display the selected results anywhere in the business process or subsequent forms it only displays the values (with underscores).

 

For example when a user selects the following options..

On the subsequent forms, emails or processes where the variable is used.. it displays the values instead of the choices.

As you all probably agree, this looks less than professional.

So I was wondering what could the best approach be to solving this issue?

We need to list out the options which were selected, but to have the underscores replaced with spaces. We also need it to be usable in an HTML block or within emails. So that means probably staging it somehow into a value input on the first form.

In another thread regex was suggested but I'm not entirely sure how we can regex the list of checked values and then use that in an HTML text block (as shown above).

So if there are any experts who could help that would be certainly most appreciated!

Cheers!

cc: @████████ @████████

1 0

Answer

SELECTED ANSWER
replied on January 10, 2020 Show version history

Just following up on this problem with the solution I ended up going with..

In order for the values selected to appear correctly in the HTML Block on subsequent forms/approvals (as shown in the original post), it was necessary to create a staging [Single Line] field for each [Checkbox] group.

Because there is no variable for "All Selected" in the calculation editor, you MUST include each individual checkbox variable. This is a real chore from both a formula and maintenance point of view.

It would have been nice to use something simple like =SUBSTITUTE(A183BenefitsAdd.AllSelected,"_"," ") but alas, without the "All Selected" variable.. you must individually specify each checkbox variable.

Doesn't seem like a problem until you realise, in order for that to display correctly in your HTML block in the followup forms.. you now need to conditionally hide or show what options were selected with comma delimitation (eg. Company Vehicle, Company Carpark).

Inevitably, this leads to writing incredibly long IF rules. Thankfully, it doesn't require nesting IFs but it is still a major pain for a simple cosmetic flaw in the way data is being displayed by Laserfiche.

For those wondering - here's exactly how I managed to get the result I wanted:

Add an extra Single Line Field:

Add your mega-concatenated-formula-with-every-possible-option-selected: angry

Pro-tip, write cumbersome calculations like these in Excel and save yourself a massive headache:

Preview your results:

Later (not shown), you would hide the Single Line Field as it is just a staging field and call the variable in your HTML block.

Frustratingly there doesn't seem to be a simple way to remove the trailing comma without getting super complicated inside the calculation and keeping in mind we can't afford to be calculating this Staging Field again, just to remove the trailing comma.

So.. there you have it. It isn't a pretty solution, but is is no less a solution.

@████████ I'd still like to lodge a tweak request for the Checkbox field so that we can be given the option to display the variable in emails and HTML blocks as comma delimited lists of names OR values.

PS. If anyone reading this has ideas or improvements to the calculation (perhaps you know a way to get rid of those trailing commas on the last option selected?) please do comment/leave or your feedback.

Thanks!

6 0
replied on January 7, 2021

Thanks for posting your solution. I used it as well for the exact same issue. I don't have a solution to those trailing commas, unfortunately.

1 0
replied on January 11, 2021

Just wanted to come back and post the solution to the trailing comma issue. The formula is =IF(RIGHT(A2,1)=",",LEFT(A2,LEN(A2)-1),A2)

A2 represents the field where the concatenation is located. I wasn't able to simply add this to the concatenation, so I created a second field and entered the formula under the Advanced tab.

Concetentation and Remove Trailing Comma.png
3 0
replied on January 18, 2021

Nice work Brandi. Fingers crossed we see this tweaked to remove the hassle in Laserfiche 11 at some point.

5 0
replied on May 1, 2024

Hi, I am trying to implement the same solution but for some unknown reason it does not work, I get an error in the formula, I am using: Laserfiche Forms Professional Version 11.0.2311.50553
I don't know if there was any change in a recent update that affected the formula or the way it is applied, or maybe it's just me that I haven't set some value correctly, any suggestions? Thank you

Advance view

Calculation Formula

=CONCATENATE(IF(Please_check_off_2_sections_you_d_prefer_to_work.Main_entrance_gate,"Main Entrance Gate, ",""),IF(Please_check_off_2_sections_you_d_prefer_to_work.Check-in_station,"Check-in Station, ",""),IF(Please_check_off_2_sections_you_d_prefer_to_work.Entry_parade_line-up,"Entry Parade Line-up, ",""),IF(Please_check_off_2_sections_you_d_prefer_to_work.Veterans_viewing_area,"Veterans Viewing Area, ",""),IF(Please_check_off_2_sections_you_d_prefer_to_work.End_of_the_parade,"End of the Parade, ",""),IF(Please_check_off_2_sections_you_d_prefer_to_work.West_parking_lot,"West Parking Lot",""))

 

checkbox.png
checkbox2.png
checkbox.png (11.32 KB)
checkbox2.png (72.82 KB)
0 0

Replies

replied on December 24, 2019

Without knowing too much about how you are utilizing the variables, I would suggest using the SUBSTITUTE formula on the selected values in some hidden fields to replace the underscores with blank spaces to display through the HTML field. You could then pattern match the individual values through workflow if needed.

2 0
replied on March 8, 2022

Thanks for posting these solutions.  I am hoping I can trouble you for a little more advice.  What if I want to use the 'Add Other Choice' to my checkbox question and include that in the IF statement in my concatenated string field.

Using your code, I can get any selected values concatenated but when I try to add in the Other value to the code, I get a calculation error (Variable not found.).  I don't really know what the variable is supposed to be.

Here is my calculation for the text field I created.

=CONCATENATE(IF(MistreatmentType.Unprofessional_behaviour,"Unprofessional behaviour, 
",""),IF(MistreatmentType.Discrimination_discriminatory_harassment, "Discrimination/discriminatory harassment, 
",""),IF(MistreatmentType.Sexual_violence_sexual_harassment,"Sexual violence/sexual harassment, 
",""),IF(MistreatmentType.Unsure,"Unsure, 
",""),IF(MistreatmentType.Other,MistreatmentType.other_value,""))

Does anyone know how to handle the value from the Other option from a checkbox field?

 

 

0 0
replied on March 9, 2022

Hi Kathrine! I'm using the 'Add Other Choice' option and here's the code I used: IF(Hobbies_and_Interests._other,Hobbies_and_Interests._other_data,"")).  Also, when you use the formula bar (displayed as fx >), you can select "other" option or "other" option value. I used "other" option value and that's what has worked. Hope that helps!

1 0
replied on March 9, 2022

Yes!  That works.  Thank you very much.

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

Sign in to reply to this post.