Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Multiplying the Display value * 80

Avatar

Level 2

how do I take the displayed value of a numeric field and multiply it by 80.  I am unable to utilize the displayed value once it has been autopopulated. It always seems to use the raw.Value (123.495949) when I only need the 123.50 to multiply * 80.  I have tried formattedValue but i am having complications.

8 Replies

Avatar

Level 10

If you create a numeric field called 'number_' with Display and Validation patterns defined as 'num{zz9.99}' and a default value of 123.495949, the value will display as 123.50.

If you create a second numeric field called 'product_' with a calculate event defined as

///////////////////////////////////////////////////////////////////////////////////////////////

// form1.page1.subform1.product_::calculate - (JavaScript, client)

this.rawValue = number_.formattedValue * 80;
///////////////////////////////////////////////////////////////////////////////////////////////
the default patterns will yield a value of '9,880'.
Do you have patterns defined on your the target of the product?
Steve

Avatar

Level 2

I am trying your answer and thanks for taking a look at this entry.  I do not understand what you mean by the target being defined product. Remember that I have another field generating the number field, which will inturn generate the product field.

Avatar

Level 10

When I say the target object I am referring to the object that contains the result of multplying the numeric field by 80. Are there patterns defined on this field?

Perhaps posting the form would expedite resolution.

Steve

Avatar

Level 2

I have attached the document in the PDF form. I hope you are using livecycle so you can view it. If not let me know and I will copy and past the xml code.-

Since you are taking the closest look at it from having the file. could you help me with the question I posted earlier today:  calculating rounding numeric fields....it all pertains to this form---Allen

Avatar

Level 2

You may want to use this form. I have deleted the unrealted objects.

Avatar

Level 10

Please send a copy to stwalker.adobe@gmail.com.

The anti-virus software has hijacked the copy posted here.

Avatar

Level 2

Yes, Steve Walker, did a fantastic job in assisting me with the answer to this problem. I was amazed at the quickness he provided an answer and was willing to look at my original document. My solution involved calcuation the hourly pay based on the salary,  round the hourly pay and then calculate the pay period off of the rounded hourly pay. Below is his solution

Salary--->  using exit, java script, client

               perHour.rawValue = (salary.rawValue) / (2080);

perHour----->  no code necessary, but you do need to change validation and disply values, refer to note below

payPeriod---->  using calculate, form calc, client

                         $ = Round(perHour, 2) * 80

          //this allowed for my payPeriod to be calcualted from the rounded number of the perHour object, which makes a big difference in a 100,000k salary

Note: when an object has been set to Value>Type>Calculated - Read Only the Validation Pattern button is disabled.  You can temporaritly enable the validation Pattern button by changing to Value>Type>User Entered - Optional.  Add the pattern(s) and set the Value>Type back to Calcualted Read Only.