Nulls¶
Almost any calculation involving a null will return null. For example, 2 + null = null.
Any comparison involving a null will always return false. This is occasionally a bit subtle: in a Comparison object, if you compare null to null, it will return whatever value you have set for the False case.
(This is in line with accepted IT industry practice for nulls in data.)
There are some exceptions, where the right thing is to produce a numeric value despite the presence of some nulls: if you use an operation object to calculate a Minimum, Maximum, or Average, nulls will be left out and the non-null values will be used to calculate the answer. For example, the Average of 1 and null is 1. (If all inputs are null, a null will of course be returned: the average of null and null is null.)
Tests¶
You can write test cases for your functions, under the “Tests” tab. Test cases let you test a function as you create it, and storing your tests within the function lets you verify that a function still does what it did when you created it, and let you re-validate a function after changes. When writing tests, you should write at least one that returns a valid result, and if it’s possible for your function to return an Error, you should write at least one test for each possible error case.
Load / Save Template¶
Clicking Save Template will save the selected function and related details to a .function file. NEXUS IC will find all items related to this function (asset information forms, event definitions, chart templates, lookup tables, etc), and will present a dialog listing all the dependencies it’s found, with a checkbox for each row. Untick any that you don’t want saved with your function.
This function can then be loaded into this or another database via Load Template. Note that if the previously saved function still exists in this database, Load Template will overwrite that existing function — it will not create a new copy of it. Similarly with any other elements saved in the .function file: asset information fields, lookup tables, etc.