Count Over-Under

Overview

This is function allows you to count how many instances in a set of values are above or below a specified threshold. For example, you have five condition parameters, and you want to know how many of them have a value greater or less than 2.14.

Type Name

‘count_over_under’

Definition Syntax

‘[value1]|[value2]|[value3]|[etc] : [threshold] : [over/under]’

where:

  • ‘value1, value2, etc’ denotes either explicit numerical values, or keys that map to values in the value dictionary. Note that the list of values is pipe-delimited.

  • ‘threshold’ is either a number or a key that maps to a value in the value dictionary.

  • ‘over/under’ is a code to specify whether the values to be counted are those that are greater than (‘over’) or less than (‘under’) the specified threshold.

Example 1

‘par_flush | par_cracks | par_poth | par_shove : f_threshold : over’

This setup code will create a function that will read the values mapped to the keys ‘par_flush’, ‘par_cracks’, ‘par_poth’ and ‘par_shove’ in the Value Dictionary. The value mapped to the key ‘f_threshold’ will be assumed to represent the threshold. The ‘over’ specification indicates that the values counted will be those over the value mapped to key ‘f_threshold’.

So, for example, if the values mapping to keys ‘par_flush’, ‘par_cracks’, ‘par_poth’ and ‘par_shove’ are 12.3, 0.0, 0.8 and 11.2, respectively with the values mapping to ‘f_threshold’ is 10, then the JFunction will return 2 since two of the four values are greater than the threshold of 10.

Example 2

‘par_flush | par_cracks | par_poth | par_shove : 2.5 : under’

This example is similar to the one above, except here we are explicitly specifying the threshold as 2.5 instead of mapping it to a value in the Value Dictionary. Also, here the ‘under’ specification indicates that we want to count the values less than the threshold of 2.5.