Description
The system can calculate results based on other numeric results. Use the Formulas page to configure a formula.
Access
AdminCenter > Order Choice Setup > Formulas
You must have the role right View/Edit Formulas (AdminCenter > Order Choice Setup > Formulas) enabled to view this page.
Technical Manual
Formula List
Show active only | Select the checkbox to have the filter only display active formulas in the system. Select Refresh to refresh the page to view new results when filtering. |
---|---|
Name | Enter the name of the formula into the field to search for a specific formula name. |
Test | Select in or enter text into the field to search for a specific test. This is a search-as-you-type field. |
Formula name | Select on the name of the formula to edit a current formula. |
Add | Select to create a new formula. |
Refresh | Select to refresh the page to view new results when filtering. |
Copy | Select the button to create a new formula using the details from an existing formula. The Formulas details page appears, where you can modify the details of the new formula. |
Formula Details
Access the Formulas details page by selecting the name of the formula in the Formula List or select the Add button.
Name | Enter the name of the formula in the field. This is a required field. |
---|---|
Tests | Select in the field to search for and select the test that will contain the result of the formula calculation. This is a required field. Note This field is disabled when the Use to calculate normalized values checkbox is selected. Instead, a list of tests the formula is assigned to appears here. |
Formula | Enter the formula ID in the field. This is a required field. This includes using results for tests in the formula in the format: #<Formula Identifier># If you don't know the name of the formula identifier for the specific test, use the Formula Parameters section to search for a formula identifier. The table displays a Formula ID and Name column. Select the blue link in the Formula ID column to add the ID to the Formula field. Note For normalized value formulas, you can't add a formula ID for one of the tests the formula is assigned to. |
Feature list | Hover the mouse cursor over the blue Feature list object to view an expanded list of the syntax and a brief explanation of every feature that the formulas currently support. |
Active | Select the checkbox to specify that the formula is active in the system and will display when filtered. Clearing the checkbox, followed by selecting Save, displays an alert pop-up showing order choices that use the associated test of the formula being edited and that making the formula inactive would affect the listed order choices. Select Yes to continue, or select No to close the pop-up without saving. Note If the formula is currently assigned to one or more tests for normalized values, you cannot mark it as inactive by clearing the Active checkbox. |
Store result in text result instead of numeric result | Select the checkbox to store the result in the text results instead of the numeric result. If the result of the formula is numeric, then it will be converted to text before being stored in the system. Note This checkbox is disabled when the Use to calculate normalized values checkbox is selected. |
Apply precision to formula parameters before calculating result | Select the checkbox to have the system apply precision to any formula parameters before calculating a formula result. |
Calculate within current order choice only | Select the checkbox to have the formula only use test results from the current order choice in its calculations, and the result of the formula also only applies to the current order choice. When it is cleared, the previous functionality is maintained. |
Prevent Evaluation on Approved Order Choices | When this checkbox is selected, tests that receive results from the formula will not be updated by the formula after the test is approved. |
Use to calculate normalized values | Select the checkbox to identify the formula as an equation to calculate toxicology normalized values. When this checkbox is selected, the Tests field is disabled, instead listing the tests the formula is assigned to. Note This checkbox is only available with a Toxicology license. |
Test Formula | Select to display the Formula Test pop-up to test the formula. See the "Test Formulas" section below for more information. |
Alerts & Comments | Select to add or view any alerts/comments added to the page. Select OK to close out of the Alerts & Comments page, or select Add to add alerts/comments. Select Add to open the Alerts & Comments pop-up, followed by adding alerts/comments in to the field. Select Save to save the alerts/comments, or select Cancel to close the pop-up. Select Cancel to close out of the page. |
Change Log | Select to display the Change Log pop-up to show all of the changes that have been made for that record.
|
Save | Select to save changes to the formula. |
< Back to List | Select to return to the Formulas list page. |
Formula Parameters
Test Name | Enter text into the field to search for a specific test. The table will automatically refresh with new results. |
---|---|
Formula ID | The table displays the formula ID in the column. Select on the blue link in the Formula ID column to add the formula ID to the last place that the cursor was in the text area in the Formula field. Text values are also supported for results by entering the identifier in the format: #<Formula Identifier>:TEXT# By default, all tests in a formula must have results in order for the formula to be evaluated. However, tests can be made optional by surrounding the formula ID with { } or [ ] . For example: {#<Formula Identifier>#} or [#<Formula Identifier>#] If the formula identifier is surrounded by { }, zero will be used as the value for the test result. If the formula identifier is surrounded by [ ], the empty result value of -999.99 will be used as the value for the test result. If the formula identifier contains the text :TEXT in order to use the text result, a blank value will be inserted for the test results in both cases. |
Name | The table displays the name of the test in the column. |
Formula Value | Enter the formula values mentioned above in the Formula Value fields listed for F/M , Female , M/F , Male , and Unknown in the Name column. |
Race/Species Name | Enter text in to the field to search for a specific race or species to be populated in the table. For example: African-American, Asian, Black, Cat, Dog, Caucasian, etc. Enter the formula value for these in the Formula Value fields. Select either Human and Animal, Human Only, or Animal Only from the Classification drop-down list to specify the classification of the race/species. Select the Show active only checkbox to have the table only show active results. |
Special Identifiers
Formulas also support these special identifiers:
#PATIENTAGE# | This will calculate the age of the patient in years, and will support up to three decimal places for the age of the patient. The value inserted is defined by the formula in the top-right table of the Formula Parameters section. |
---|---|
#PATIENTRAC# | This will insert a value into the formula based upon the patient's race or species for veterinarian setups. The value inserted is defined by the formula in the bottom-right table of the Formula Parameters section. |
#PATIENTSEX# | This will insert a value into the formula based upon the patient's sex. |
The special formula identifiers also support being surrounded in { } to make them optional. In this case, the value of one will be inserted for the identifiers. Surrounding the identifiers in [ ] is not supported at this time.
Note that formulas support the basic mathematical operators of +, -, /, \, *, ^, ( ) for numeric results. The difference between the / and \ operators is that / performs real number division, while \ performs whole number division. For text results, only the + operator is supported.
Commands
Formulas also support the commands Num, Log, Log10, Exp, Abs, Dec, Round, Trunc, Min, and Max. See the table below for more information.
Name | Format | Usage |
---|---|---|
Numeric | Num(#<Formula Identifier>:TEXT#) | Num can be used to convert a numeric value stored in a text result to an actual number that can be used in mathematical operators. This will take the text result for the test and attempt to convert it to a number in the formula. If the text result cannot be converted, the formula will create an error and cannot be evaluated. |
Logarithm | Log(<Value>) | Log can be used to take the natural log of a value. |
Logarithm 10 | Log10(<Value>) | Log10 can be used to take the log base 10 of a value. |
Exponent | Exp(<Value>) | Exp is the inverse of the natural log and raises a value by the power of Euler's Number |
Absolute | Abs(<Value>) | Abs takes the absolute value of a number. |
Decimal | Dec(<Value>) | Dec returns the decimal portion of a value. |
Round | Round(<Value>;<Precision>) | Round rounds a value to the specified precision. |
Truncate | Trunc(<Value>;<Precision>) | Trunc truncates a value to the specified precision. |
Minimum | Min(<Value 1>, <Value 2>, ..., <Value n>) | Min finds the smallest number in a list of numbers. Semicolons can also be used instead of commas to delimit the values. The values can also come from test results specified by a formula identifier. |
Maximum | Max(<Value 1>, <Value 2>, ..., <Value n>) | Max works the same way as the Min command, but it finds the maximum value in the list. |
Note that formulas also support comparisons with the operators >, >=, <, <=, =, and <>. If the comparison is true, it will be replaced with a one, and if the comparison is false, it will be replaced with a zero. Comparison example:
(#Formula Identifier 1#>#Formula Identifier 2#)
Conditional Formulas
Formulas also support conditional formulas in the format:
(<Comparison>)?(<Formula or values to execute if true>) : (<Formula or values to execute if false>)
If the comparison evaluates to be true, then the true section will be used for the formula result, while if the comparison evaluates to be false, then the false section will be used. Conditional formulas can also be entered in the format:
(<Comparison>)?(<Formula or values to execute if true>)
that is missing the false section. In this case, the formula will not change the result if the comparison is false.
Test Formulas
Once the formula has been defined, test the formula by selecting the Test Formula button on the Formulas details page to open the Formula Test pop-up.
The Formula Test pop-up will list the formula as it currently exists at the top of the pop-up and will populate a table with a row for every formula identifier in the formula. It will also populate a row for any special identifiers in the formula, such as #PATIENTSEX#, #PATIENTAGE#, and #PATIENTRAC#. The user can fill in values to be inserted into the formula for each identifier.
Formula | Displays the formula as it currently exists. |
---|---|
Formula ID | Displays the formula ID. |
Test Name | Displays the test name |
Value | Enter values to be inserted into the formula for each identifier. |
Calculate Result | After filling in values, select Calculate Result to run the formula with the current values. If no issues occur while running the formula, the result of the formula will be displayed at the bottom of the pop-up. If an issue does occur while running the formula, the issue will be displayed in an alert to the user. Potential issues that could keep a formula from evaluating include:
When editing or adding a formula, a name, test to calculate results for, and formula must all be specified in order to save. Additionally, circular formulas are not allowed to be entered. A circular formula is a formula that contains the formula identifier of the test that the formula is being evaluated for. This includes other formulas that affect the result of the formula as well. For example: if you have two formulas, and formula one calculates its result from the test calculated by formula two, and formula two calculates its result from the test calculated by formula one, then that is considered a circular formula because the two formulas would constantly update each other instead of evaluating to a specific result. Formulas will be evaluated for the entire order rather than just the selected order choice. This means that it is possible for results on a different order choice on the order to be updated while modifying an order choice. It is also possible for an approved order choice on an order to have its results amended by formulas when a different order choice is updated. If this case occurs, then a comment will be added to the amended test result in order to state that formulas amended the result and how the result was changed. All formulas on the order will be evaluated when the user opens the Approve Results pop-up on the Work in Progress page. Formulas will be sorted so that any formulas which would affect the result of other formulas will be evaluated before the other formulas are evaluated. After that point, formulas will be evaluated when changes are made to the numeric or text result. Only formulas that are affected by the changed result will be reevaluated. If the user cancels on the Approve Results pop-up, then any changes made by formulas will be discarded. Formulas will also run for instrument results received from a device engine. In this case, all formulas on the order will be evaluated when the instrument results are received. |
OK | Select to close the Formula Test pop-up returning to the Formulas details page. |