Make Minor Math Updates in the UI using Blockly

Overview

You can make mathematical adjustments to your Visualizer using the programming software Blockly. Only minor adjustments affecting very few calculations and/or variables such as changing addition to subtraction are made to the Visualizer Type. 


The math connecting your inputs and outputs is all in Blockly, a user-friendly programming language where all statements are represented by blocks that can be physically connected. There are 4 types of blocks you can paste: you will only need “Logic”, “Math”, and “Variables”.

Step-by-Step Guide


  1. Follow the steps to Upload your Model/Create a Visualizer Type.


  2. Click Code on the Visualizer Type page.


  3. The Code page appears.

Getting to Know the Different Sections




  1. The Logic section controls all statements related to logic


  2. You can drag the block out into the field. You can attach blocks to the “if” and “do” segments to control the math. For instance, if a certain input variable is 0, you might have to change an output variable to a different calculation to prevent division by zero errors. 


  3. If you click the gear icon in the 'if' block, you can construct a more advanced if statement. Simply drag blocks from the left box to the right box to construct your statement. You can add an “else / do” or “else if / do” under your regular “if / do” statement. 


  4. The next block is an equality statement. It helps you to check if two numbers are equal, less than/greater than, etc. 


  5. The next block is the and/or statement.


  6. Then there is the not block and finally the true/false block. 


  7. The Math section controls all the math between your variables.


  8. The first is a number. Anytime you use a number in your statements, you must use this attachment and enter a number in, instead of entering them in the white space or there will be an error. 


  9. Next is a four-function calculator between two values. You simply drag the number of variables into the empty slot, and you’ll hear a *click* noise as the code attaches itself. 


  10. Next is the min/max function.


  11. Then comes the average function.


  12. Next comes the IRR function.


  13. Then comes the XIRR function.


  14. Then comes the NPV function.


  15. Then comes the rounding function.


  16. Last is the log function.


  17. The Variables section has two block types. The first is a “get” statement, which retrieves the current value of any input or output variable for your code. 


  18. The second is a “set” statement, which sets the value of an output variable to the code you attach to the right. For instance, you can set an output variable to be the sum of two input variables, or a percentage of an input variable, etc. 

Updating the Blockly


 

  1. Every output variable in your model will be represented here. You can find the calculation that you would like to adjust and change however you like. 


  2. Click the Save button at the bottom of the screen. The system will verify that your code is valid, or report errors. 


  3. Ensure that that all the variables you reference in the Blockly code you add are defined further up in the codebase - NOT further down, otherwise, it will cause errors.

Note:


  1. When you update the UI using Blockly code, these changes will not get reflected in the Excel model that you have uploaded. Hence, it is recommended to update your Excel model as it is the source of truth.


  2. You can simply update your model (without importing it) alongside system changes, so that in case you need to perform more major updates later you have the option, without going through the painful process of updating via model upload. 


  3. Ensure to get training from the ValueCore team before making changes in Blockly.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us