These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Simple equation which works but is this the way it should be done

RustyWood
Registered: Mar 16 2010
Posts: 83
Answered

Hi this is an equation for how many Sra3 sheets I need to make 12 cards, it works which is a good start, but is the correct way to write it?

var a = this.getField("participant_1_total_packs_of_12_cards").value; //
event.value = a * 12 / 3; //

With thanks

Rusty

My Product Information:
Acrobat Standard 9.0, Macintosh
jimhealy
Team
Registered: Jan 2 2006
Posts: 146
Looks fine to me. You might want to round the answer. This will round to 2 decimal places:
event.value = util.printf("%02.2f", a * 12 / 3);

Jim Healy
FormRouter, Inc.
Check out our FREE Advanced Acroform Toolset:
http://www.formrouter.com/tools

Jim Healy, Founder & CEO FormRouter Inc.
Chapter Leader AUG RTP NC
http://www.formrouter.com

RustyWood
Registered: Mar 16 2010
Posts: 83
Thanks Jim but what exactly does util.printf mean?

Rusty
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
The 'util.printf()' method is one of Acrobat JavaScirpt's 'util' object for formatting various stings. the printf method can specify how to format numbers of different bases or character strings of numbers into a specified number format. There are also the printd method for date and time and the printx method for character patterns. More information is contained in the Acrobat JavaScirpt API Reference.

George Kaiser

RustyWood
Registered: Mar 16 2010
Posts: 83
Thanks very much I am reading up but there is a lot to learn!!

Thank you again for the info.

Rusty