Range check

Check if a given value is in the range or not.

Rule description: the Oral Temperature must be between 35-40.6 C or 95-105 F (inclusive).

Rule expression

if(tempval!==null)
{
if(getStringFromChoice(tempunit)==='C')
{
   if(tempval>=35.0 && tempval<=40.6)
   {
       return true;
   }
   else
   {
       setQueryMessage("The value entered for Oral Temperature is out of range: 35-40.6 °C. Please confirm or correct.")
       return false;               //System sends query if return false condition is met
   }
}
else 
{
   if(getStringFromChoice(tempunit)==='F')
{
   if(tempval>=95.0 && tempval<=105.0)
   {
       return true;
   }
   else
   {
       setQueryMessage("The value entered for Oral Temperature is out of range: 95-105 F. Please confirm or correct.")
       return false;               //System sends query if return false condition is met
   }
}
else
{
   return true;
}
}
}
else
{
   return true;
}

Query message (Dynamic): The value entered for Oral Temperature is out of range: {tempRange}. Please confirm or correct.

Definitions

tempval

Corresponds to the Temperature from rule description.

tempunit

Corresponds to the Temperature unit from the rule description.

getStringFromChoice( )

Convert the label of the selected choice from a drop-down, radio button or check box into a string or comma-separated value. Takes in the question item variable as parameter.

setQueryMessage( )

Specify dynamic query text passed in as a parameter.

Return value

Boolean

Returns either true or false. System raises query when return false condition is met.

Verification steps

  1. Using a subject for testing, go to the given visit and form containing the value to check, in this example the oral temperature value <tempval>.
  2. Update the form items tempval and tempunit as in the following table and verify the result is as listed:
    tempval tempunit Notes Result

    35.0

    C

    tempval matches the lower range limit for °C temperatures (35.0 - 40.6). No query

    34.9

    C

    tempval is lower than the lower range limit for °C temperatures (35.0). Query

    35.1

    C

    tempval is in range for °C temperatures (35.0 - 40.6). No query

    40.6

    C

    tempval matches the higher range limit for °C temperatures (40.6). No query

    40.5

    C

    tempval is in range for °C temperatures (35.0 - 40.6). No query

    40.7

    C

    tempval is higher that the higher range limit for °C temperatures (40.6). Query

    40.7

    F

    tempval is lower than the lower range limit for °F temperatures (95 - 105). Query

    94.0

    F

    tempval is lower than the lower range limit for °F temperatures (95 - 105). Query

    95.0

    F

    tempval matches the lower range limit for °F temperatures (95 - 105). No query

    96.0

    F

    tempval is in range for °F temperatures (95 - 105). No query

    105.0

    F

    tempval matches the higher range limit for °F temperatures (95 - 105). No query

    104.0

    F

    tempval is in range for °F temperatures (95 - 105). No query

    106.0

    F

    tempval is higher than the higher range limit for °F temperatures (95 - 105). Query

    103.0

    F

    tempval is in range for °F temperatures (95 - 105). No query

    103.0

    C

    tempval is higher that the higher range limit for °C temperatures (40.6). Query

Note:

Repeat the above steps if the form is present in multiple visits.

Other examples

Example 4-1 The weight must be between 36.2-136.1 kg or 80-300 lbs (inclusive)

if (wtval!==null)
{
if (getStringFromDropdown(wtunit)==='kg')
{
    if (wtval>=36.2 && wtval<=136.1)
    {
        return true;
    }
    else
    {
        return false;
    }
}
else 
{
    if (getStringFromDropdown(wtunit)==='lb')
{
    if (wtval>=80.0 && wtval<=300.0)
    {
        return true;
    }
    else
    {
        return false;
    }
}
else
{
    return true;
}
}
}
else
{
    return true;
}

Query message: The value entered for Weight is out of range. Please confirm or correct.