Partial date comparison with dynamic query text
Compare two date questions where at least one of the dates is partial then issue a query that contains dynamic text if the dates are not as expected.
Rule description: AE Stop Date must be on or after the Date Informed Consent.
Note:
If any parts of AE Stop date are unknown (UNK), compare the available date parts.
Rule expression
if(getDatesCompareResult(aeenddt,true,infconsdt,false,'>=')) {
return true;
}
else
{
setQueryMessage("AE Stop date "+getDateDMYFormat(aeenddt,true)+" is prior to Informed Consent date "+getDateDMYFormat(infconsdt,false)+". Please correct or confirm.");
return false; //Query message set dynamically. System sends query when return false condition is met.
}
Query message: AE Stop date is prior to Informed Consent date. Please correct or confirm.
Definitions
- aeenddt
-
Corresponds to AE Stop Date from the rule description (Partial Date), followed by
True
, as AE Stop Date is partial date. - infconsdt
-
Corrsponds to the Informed Consent Date from rule description (full date), followed by
False
, as Informed Consent Date is full date. - >=
-
Greater Than or Equal To operator. Update operator based on the rule description.
- getDatesCompareResult( )
-
Compares two dates (aeenddt, infconsdt) using the passed in operator (>=). In this case: aeenddt >= infconsdt.
- getDateDMYFormat( )
-
Use the getDateDMYFormat helper function to return a date (including partial dates) in DD-MON-YYYY format.
Return value
Usage tips
- Use this when comparison should be performed for date questions and at least one of the dates is partial.
- Query text should contain the dynamically entered date question values in it.
Verification steps
- Using a subject for testing, go to the given visit and form
containing the date items to compare, in this example the AE stop
date <
aeenddt
> and date of informed consent <infconsdt
>. - Update the form items
aeenddt
andinfconsdt
as in the following table and verify the result is as listed:aeenddt
infconsdt
Result Null
02-Dec-2021 No query 02-Dec-2021 02-Dec-2021 No query 01-Dec-2021 02-Dec-2021 Query. UNK-Dec-2021 02-Dec-2021 No query UNK-Nov-2021 02-Dec-2021 Query. 03-Dec-2021 02-Dec-2021 No query 03-Dec-2021 05-Dec-2021 Query 03-Dec-2021 02-Dec-2021 No query 03-Dec-2021 01-Jan-2022 Query 03-Dec-2021 04-Dec-2021 Query 03-Dec-2021 Null
No query 03-Dec-2021 02-Dec-2021 No query 01-Dec-2021 02-Dec-2021 Query
Note:
Repeat the above steps if the form is present in multiple visits.
Other examples
Example 4-24 Date of Study Completion must be on or after the Last Date of Study Drug
Note: If any parts of the parts of the Last Date of Study Drug are UNK, compare the available date parts.
if(getDatesCompareResult(compdt,false,drugdt,true,'>='))
{
return true;
}
else
{
setQueryMessage("Date of Study Completion "+getDateDMYFormat(compdt,false)+" is prior to Last Date of Study Drug "+getDateDMYFormat(drugdt,true)+" .Please correct or confirm.");
return false;
}
Query message: Date of Study Completion is prior to Last Date of Study Drug. Please correct or confirm.
Example 4-25 CM Stop Date must be on or after CM Start Date
Note: If any parts of CM Start/Stop date are unknown, compare available date parts.
if(getDatesCompareResult(cmenddt,true,cmstdt,true,'>='))
{
return true;
}
else
{
setQueryMessage("Date of Study Completion "+getDateDMYFormat(cmenddt,true)+" is prior to Last Date of Study Drug "+getDateDMYFormat(cmstdt,true)+" .Please correct or confirm.");
return false;
}
Query message: CM Stop Date is prior to CM Start Date. Please correct and clarify.
Parent topic: Dates with Dynamic Query Text