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

Question

Question

Adding a percentage symbol at the front of a form field.

asked on December 16, 2024 Show version history

Hi all, 

 

I found another post and managed to use the concatenate formula to get the percentage field working however, with this method the value passed over does not seem to be formatted to 1 decimal like I have set. 

 

There are 2 hidden fields which calculate the percentage of business vs personal usage.

b_percentage and p_percentage, they are a number field with 1 decimal place set.

Then I have 2 Single Text fields (business_percent_display and personal_percent_display) displaying the percentage has the formula

=CONCATENATE(b_percentage," ","%")

=CONCATENATE(p_percentage," ","%")

The result they show is . 

I have also tried adding some regex in to get the first two digits as a test using the pattern \d\d

I would just like them to show the percentages with 1 decimal place like the hidden fields.

What is the best way to tackle this?

 

Thank you

 

0 0

Answer

SELECTED ANSWER
replied on December 16, 2024

Instead of trying to use regex (not really sure what you were trying to accomplish with it, exactly), you can just round the number to 1 decimal place before converting it to a string.

=CONCATENATE(ROUND(b_percentage,1)," %")

1 0

Replies

replied on December 16, 2024

I found another post and managed to use the concatenate formula to get the percentage field working however, with this method the value passed over does not seem to be formatted to 1 decimal like I have set. 

What's your formula? Which percentage field? Which value of which field is not formatted the way you wanted? What is the type of field you are using (single line I'm guessing)? What is the formatting that you are attempting to achieve? What is your regex? It's very difficult to understand the problem and what the desired outcome is.

1 0
replied on December 16, 2024

Thanks good point, I have added more info.

1 0
SELECTED ANSWER
replied on December 16, 2024

Instead of trying to use regex (not really sure what you were trying to accomplish with it, exactly), you can just round the number to 1 decimal place before converting it to a string.

=CONCATENATE(ROUND(b_percentage,1)," %")

1 0
replied on December 16, 2024 Show version history

Fantastic, thank you that works, I need to be more mindful of my data types.

 

I thought maybe a regex getting the first 2 digits might be a solution (should be 3)

 

Appreciate it Kevin, Merry Christmas!

 

0 0
replied on December 16, 2024 Show version history

Forms field input validation regex is only for input validation, not for formatting output. You must use a formula or Javascript to accomplish that. Glad it worked for you.

1 0
replied on December 16, 2024

Thanks for the tip!

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

Sign in to reply to this post.