Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Calculating a field that needs to be text

Avatar

Former Community Member

Hi,

I am wondering if anyone knows of a way to add a text field into a calculation?

I have a column of fields that need to state a rate per hour but that field needs to be included into an amount column that calculates teaching hrs x rate per hour. How do i get to have the rate per hour field as a text field and included into the calculation?

Or if there is another object i can choose to allow me to do what i need to.

Thanks

Jennah

3 Replies

Avatar

Level 10

Hi,

You should keep the objects as numericfields and then apply a pattern in the Object/Field tab that includes the text label that you want to follow each number. This way the user will see the label, but the calculations will only use the numbers.

Parallels DesktopScreenSnapz004.png

First you add the data pattern you want for the object and then you add the label using single quotes. The additional bits you add to the standard patterns are shown in red.

The pattern for the teachers' hours would be num{z,zzz,zzz,zz9' hrs'}

The pattern for the rate would be num{$z,zzz,zz9.99' rate/hr'}

Hope that helps,

Niall

Avatar

Former Community Member

Hi Niall,

Thank you, it does help for others forms i will have to create but for this one in particular i need to have the rate per hour fields as a field that displays the text, we dont want them to enter the $100.00 for the per hour rate.

Does that help a little more in what i need fixed???

Thanks.

Avatar

Level 10

Hi,

Here is an amended sample. I don't think it is possible to do what you want, if I understand your requirement correctly.

There is a FormCalc function called Wordnum(), which will change a number into an english text string. There is a sample of this in the form, where you put in a rate in the left hand field (number) and the rate appears in text in the right hand field. However I do not know how to get the total calculation to deal with a text string.

The only other (messy) option is to use a dropdown, with specified values in the Object/Binding tab. Here the user sees set rates in text, but behind the scenes Acrobat sees numbers.

Parallels Desktop.png

Hopefully someone else will have a more elegant solution.

Good luck,

Niall