Display state based on corresponding integer input

For situations where an integer value is relating to a state/status (e.g. 1 = Clear, 2 = Caution, 3 = Warning, etc) it can be helpful to display the corresponding status rather than the integer value. To do this:

  1. From ExoSense, click on Configuration
  2. Click on Insights at the top
  3. Click on the** + **button and select Create New Custom Insight Function
  4. Name the function and give it a brief description
  5. For the Input, enter a name and description and select Numeric as the Primitive Type leaving the Data Type(s) and Unit unchanged
  6. For the Output, enter a name and description and select String as the Primitive Type, again leaving Data Type(s) and Unit unchanged. See example picture below:
  7. Delete any Constant that is currently set
  8. Under the Logic section, select MathJS for the Library and use the following, tweaking the integer values and states as necessary: (A == 1)?"Clear":(A == 2)?"Caution":(A == 3)?"Warning":(A == 4)?"Critical":"error"
  9. Click Save to create the Insight Function

You are now ready to use this Insight Function on your signal. To apply this Insight Function to a signal, we will need to add a transform to your signal. To do this:

  1. Navigate to your asset in ExoSense
  2. Click on Modify Asset Config in the top right
  3. Select the three-dot menu on the signal you want to apply this Insight Function to and select Add Transform
  4. Change from the Standard Insights Module to your custom Insights Module
  5. Select your newly made function from the drop-down list
  6. Click Save to apply the change

You should see now that there is a transform under your original signal that is ready to be used.

1 Like