Knowledge Base Article

Referencing Equations or Constants in Formulas

You can call equations and constants or used dataset information from within your equations and constants.  We call these:

                   `(CiC)` - Constant in a Constant  `(CiE)` - Constant in an Equation
                   `(EiC)` - Equation in a Constant   `(EiE)` - Equation in an Equation
                   `(DiC)` - Dataset in a Constant    `(DiE)` - Dataset in an Equation

CiC-Menu.png Find your constant or equation in the Equation Editor Algorthm Tab 
It is very useful to call existing equations and constant within your equations and constants to save work and keep from replicating code over again.  It is also useful and powerful to access data from vCalc datasets. vCalc keeps track of the constants, equations and datasets that you use and automatically provides a guide in your wiki to show what you have used.
TableDragDrop.png  Drag the Table ID into the Algorithm window 

How To

To use a CiC, CiE, EiC, EiE, DiC or DiE go to the algorithm tab in the appropriate editor (Equation Editor or Constant Editor).  In the tab, you will see a listing of available equations and constants on the right side of the algorithm window (see diagram).  The list shows equations and constant from your library, those shared with you and those in the public library.  CiC-Algorithm1.png  The equation or constant reference will be added to your algorithmUse the list to find the equation or constant that you want to use in your equation or constant. 

Click and drag your choice into the algorithm window unit. Make sure it is over the line CiC-Algorithm2.png                   Move the reference and assign to local variablenumbers on the far left side of the algorithm window and release.  You will notice that the token has a red x while you're dragging it until you are over the line numbers when it turns to a green check.  When you release the button, the equation or constant reference will be added to your algorithm on the last line.  You may need to cut/copy/paste the reference to the right place in your algorithm.

If you have referenced an equation, there are likely to be input parameters.  The names of those parameters are inside brackets (e.g. <input1>,<input2>).  You can replace the names with actual numbers or with local variable from your algorithm.  Note: make sure you eliminate the brackets <>  when you make the substitution. 

For datasets, the click and drag action will insert a line of code that includes the dataset's ID.  All of the Dataset Functions require a "String uuid".  This is the identifier.  You can also see and copy the dataset ID in the wiki for the the dataset.  

To See the working example equation (below) , click Weight of Sea Water in a pipe.
CiC-Algorithm3.png    Complete algorithm with a CiE and EiE.