Setting number precision in Toolbook Action Editor

In Toolbook 10.5, there is a function round(number,exp) to do this setting precision. However, it seems that the function is buggy. When I tried it in action editor, it gives me error saying that the argument is too many. So I need to find a work around for this. One way that I found is to use javascript function toPrecision(). These are the steps:

  1. Create a javascript file, e.g. setPrecision.js
  2. Write the a function to call toPrecision javascript function. Note that Toolbok requires the function name to starts with tbfunction_. You can download the javascript file that I use.
  3. Then in your Toolbook Author View, click the Menu “Object”->”Properties for Book”.
  4. Click the Tab “Web”.
  5. Click the button “Import”, and select your javascript file.
  6. Once you have imported to your book you can use it in the Action Editor.
  7. Go to Action Editor, find “Execute Script” and drag into the code area.
  8. Click “Properties”, and set in the parameters. In the file that I gave the first parameter is the floating point number, and the second one is the number of precision.
  9. Set the return value of the function. You may want to create a variable to store the return value. And you are Done!

References:

ADDING JAVASCRIPT TO YOUR PROJECT

JavaScript toPrecision Method

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: