Expand my Community achievements bar.

Don’t miss the Workfront AMA: System Smarts & Strategic Starts! Ask your questions about keeping Workfront running smoothly, planning enhancements, reporting, or adoption, and get practical insights from Adobe experts.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

A custom field with a percentage sign

Avatar

Level 3

Hi all.

 

I am in the process of building a custom form and I will need to allow users to enter a field with a percentage sign. For example, 10% or 20%.

 

This is easily achievable if the field is of a Text format.

 

But the challenge is that because this field is also part of a math calculation in the form, it has to be set as the Number format (as opposed to Text).

 

If a field has the Number format, users would not be able to enter the percentage sign. So instead of, say, 10%, the expected value is 0.1. This won't be ideal because I still want users to enter the value with a percentage sign (easier on the eye as well).

 

What is the best way to tackle this? I was thinking I could keep this field as Text format so that users can still input the % sign, and then use a calculated field to manipulate this string and this will be a Number field. Then I can use this calculated field as part of the formula.

 

Or is there any other clever way that I have missed?

 

Many tanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You can skip the interim calculated field altogether, and just use the string in your calculation.

Let's say you have a text field called "value_percent" and you need a separate calculated field in the form to reference "value_percent" in a math calculation.

You can simply reference {DE:value_percent} in your calculation. The data types are weak, so Workfront is smart enough to understand that "20%" is a number, even if it's stored in a string-type field. The only problem is that Workfront will interpret it as "20" instead of "0.2". That is easily fixed by dividing value_percent by 100.

All you need to do is insert the below calculation in the part of your formula that refers to the value_percent value:

DIV({DE:value_percent},100)

If the text entered in value_percent is "20%" the above will return "0.2"

This can be part of any math formula. E.g.: 

DIV({DE:value_percent},100)+1

would return "1.2" in the above example. 

If you like my content, please take a moment to view and vote on my Idea Requests: https://tinyurl.com/4rbpr7hf

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

You can skip the interim calculated field altogether, and just use the string in your calculation.

Let's say you have a text field called "value_percent" and you need a separate calculated field in the form to reference "value_percent" in a math calculation.

You can simply reference {DE:value_percent} in your calculation. The data types are weak, so Workfront is smart enough to understand that "20%" is a number, even if it's stored in a string-type field. The only problem is that Workfront will interpret it as "20" instead of "0.2". That is easily fixed by dividing value_percent by 100.

All you need to do is insert the below calculation in the part of your formula that refers to the value_percent value:

DIV({DE:value_percent},100)

If the text entered in value_percent is "20%" the above will return "0.2"

This can be part of any math formula. E.g.: 

DIV({DE:value_percent},100)+1

would return "1.2" in the above example. 

If you like my content, please take a moment to view and vote on my Idea Requests: https://tinyurl.com/4rbpr7hf

Avatar

Level 3

@William--

Apologies for the late response as I didn't get the notification email saying my questions has got an answer.

It is helpful to know that the data type in Workfront is weak as well.

gigixjin_0-1669916586128.png

All works as expected. Thanks a lot!!