Action Calculator iBloc

The Action Calculator iBloc executes equations using Input widgets without refreshing the page, and displays the results in a Text or Input widget.

Current Version: 1.2.2
Supported iRise Studio Versions: 8.7 – 8.12
Supported Browsers: IE 8.0+, Firefox 3.5+, Safari 4.0+, Chrome 8.0+, iOS Safari, Android (default browser)
Works in iRise iPhone and iPad apps: Yes

What does it do?

  • Dynamically performs calculations without requiring a page refresh
  • Can be triggered with any event (onLoad, onClick, onChange, etc.) like a standard Action
  • Allows you to create your own equations using up to 10 input widgets as variables
  • Equations can include numbers, parentheses, and standard operators (+ – * / %)
  • The result can be shown in any number of Input and/or Text widget(s)
  • The result can also be shown in one of the widgets used as an operand in the equation
  • Multiple ActionCalc iBlocs may be used on a single page
  • Inputs can contain commas or non-numeric characters (e.g., “$”)
  • Answer can be formatted with or without commas and any number of decimal places

How do I use it?

  1. Drag the iBloc onto the canvas.
  2. In the Properties panel, enter an equation (default is “a + b”) using numbers, parentheses, numbers, operators  (+ – * / %) and/or the letters a – j as variables.
  3. Select a widget to display the result by clicking the “…” button next to “Result Widget” and choosing a Text or Input widget.
  4. Enter the desired Precision (number of places after the decimal – default is 2, use 0 for an integer result).
  5. Place Input widgets onto the page to use as variables for your equation (you can also use any input widgets already on your page).
  6. Select Input widgets for each variable letter used in your equation, by clicking the “…” button next to each letter variable used and choosing a an Input widget.
  7. (Optional) Enter a text string or number to display in the result widget if invalid (non-numeric) values are entered into selected Input widgets.

Tips & Tricks

  • Initial values for variable and result Inputs can be populated from a Datasheet or entered manually as the default value property of the widget.
  • To use values from a Datasheet in your equation that you do not want to display on the screen, use hidden Input widgets.
  • To send your result to a Clipboard or Datasheet, use an Input widget inside a form for your result, and submit normally.
  • Dynamic spreadsheet-like behavior can be simulated by using result widgets as variable inputs in other ActionCalc iBlocs, and triggering them with onChange events.
  • To show the result in one of the widgets used as an operand in the equation, check the box next to “Show result in input widget ‘a’” in the Properties panel. This will display the result in the input that you selected as widget ‘a’. This is useful if you want your calculation to update a widget used in the equation, such as incrementing a number in a ‘spinner-like’ input.

Feel free to download this and any of our free iBlocs here, and please tell us what you think.

1 reply
  1. Orlando says:

    Would it be possible to use this iBloc to dynamically dictate the view of a dynamic display based on the output of a drop down selection? I will download it to try it out but i think that dynamically obtaining widget input responses without refreshing the page is something that iRise dearly needs.

    In my scenario, i have a complex form with interactions that dynamically update input widgets to enabled based on a drop down selection’s value. It won’t work for me to use any submit form actions because a page refresh would cause the error validation logic to trigger errors on the remaining empty fields.

    I’m hoping that i can possibly use this to capture the output of the drop down box and tie in some switch view actions to it but i’m thinking that this iBloc is limited to widget input responses only. i may just have to create a custom drop down box to handle this.

    Love using your widgets, they really help. Keep up the great work. If you guys can ever make an iBloc to handle those sort of advanced scenarios, i think you would make alot of iRise modelers ‘very happy’ =D

    • Eric Romanik says:

      Orlando, what I believe you are trying to do is supported natively by iRise and doesn’t require any iBlocs. You can make views change dynamically based on the value of a drop down (or any input widget). Here’s how:

      1. Create your set of views, and look at the “Views” properties panel. You can access this by clicking on the little view icon in the upper left corner of your views, or click on the Views tab in the property panel of any individual view.

      2. In the properties panel, click on “Edit Rules” under the list of views.

      3. In the dialog that appears, select “based on widget” for “View is selected…”, and select the drop down that you want to control your views with for “Criterion”.

      4. Enter the values in the drop down that you want to correspond with each view.

      Let me know if this method can achieve the effect you’re after. If not, there may be an opportunity to solve it with an iBloc.


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© Copyright 2017 - id8    Privacy Policy