Partial date unknown month evaluation
Check if the month of the date question is selected as unknown (UNK) and display a query if needed.
Rule description: if UNK is selected as Month for Date of Initial Diagnosis then a query is issued.
Rule expression
if(DIADT.getMonth()==='UNK') //checks for the presence of 'UNK' value as the month of a date
{
return false; //System sends query when return false condition is met
}
else
{
return true;
}
Query message: UNK has been selected for Month. Please verify and provide.
Definitions
- DIADT
-
Corresponds to the Date of Initial Diagnosis from rule description.
- ===
-
Equal to comparison operator. Compares both the value and type to be equal.
- .getMonth()
-
JavaScript method for date type elements. Retrieves the numeric value of the month in a date, for example '11' as the numeric value of Novemeber in '01-Nov-2021 15:03'. Returns 'UNK' if month value is not present.
Return value
Verification steps
- Using a subject for testing, go to the given visit and form
containing the date item to check, in this example the date of initial
diagnosis <
DIADT
> . - Update the form item
DIADT
as in the following table and verify the result is as listed:DIADT
Result 10-May-2021 No query UNK-UNK-2021 Query UNK-May-2021 No query 05-Jun-2021 No query UNK-UNK-2021 Query Null
No query
Note:
Repeat the above steps if the form is present in multiple visits.
Parent topic: Partial date comparisons