Date comparison within range: On or after

Check if one date is the same, or a number of days after (inclusive) another date, and raise a query if the date is outside of this window.

Rule description: the Date of Study Completion must be on or within 30 days after the V5C Visit Date.

Rule expression

//to meet the rule description criteria DSENDT1-VISDAT should be between 0 and 30 (inclusive)
//so greater than or equal to 0 (>=0) AND less than or equal 30 (<=30)
if(dateDiffInDays(DSENDT1,VISDAT)>=0 && dateDiffInDays(DSENDT1,VISDAT)<=30)
{
    return true;
}
else
{
    return false;                    //System sends query when return false condition is met
}

Query message: Date of Study Completion is prior to, or not within 30 days of, V5C DOV. Please verify.

Definitions

DSENDT1

Corresponds to the Date of Study Completion from the rule description.

VISDAT

Corresponds to the Visit Date from the rule description.

>=, <=

Greater Than or Equal To and Less Than or Equal To operators. Update operator based on the rule description.

dateDiffInDays

Calculates difference between date1 (DSENDT1), date2(VISDAT) (date1-date2) in days.

Return value

Boolean

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

Usage tips

Always use the relevant date helper function to compare dates rather than comparing the variables directly using comparison operators.

Verification steps

  1. Using a subject for testing, go to the given visit and form containing the date items to compare, in this example the date of study completion <DSENDT1> and 'V5C' Visit date <VISDAT>.
  2. Update the form items DSENDT1 and VISDAT as in the following table and verify the result is as listed:
    DSENDT1 VISDAT Result
    Null 10-May-2021 No query
    10-May-2021 10-May-2021 No query
    10-Jun-2021 10-May-2021 Query
    09-Jun-2021 10-May-2021 No query
    10-May-2022 10-May-2021 Query
    11-May-2021 10-May-2021 No query
    11-May-2021 05-May-2022 Query
    11-May-2021 11-May-2021 No query
    11-May-2021 Null No query
    11-May-2021 06-May-2022 Query

Note:

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

Other examples

Example 4-15 'Collection Date' must be within 30 days of 'Date Initial Informed Consent Obtained'

if(dateDiffInDays(COLLDT,INFCNST)>=0 && dateDiffInDays(COLLDT,INFCNST)<=30)
{
    return true;
}
else
{
    return false;
}

Query message: Collection Date is not within 30 days of Date of Initial Informed Consent Obtained. Please Verify.