Sample data-entry rules that use functions

The _GetDateDifference function uses twenty-four hour periods, not calendar days, to compute the differences in days. If the DOV item contained date and time information, there are two possible solutions. The first solution uses the complete DOV date/time and the _GetDateDifference function and therefore evaluates days as twenty-four hour periods. The alternate solution evaluates the differences between DOVs using calendar days by creating new DateTime objects that contain no Time information from the DOVs and passing those new DateTime objects to the _GetDateDifference function. Each of the solutions uses the predefined constant DateTimeParts.Days.

Example 1

Characteristic Description

Description

Create a rule named rulWeekSeqCk that checks that there are 7 days between Week 1B and Week 2B visits. Issue a query on the Week 2B DOV item (in Treatment Arm B), if the DOV on the Week 2B study event is less than 7 days after the DOV on the Week 1B study event.

Scope

Treatment Arm B study element

Study structure

  • Week 1
    • frmDOV (form)
      • DOV (item)
  • Week 2
    • frmDOV (form)
      • DOV (item)

Rule summary

evaluate on Form Submission

value = _GetDateDifference
(this.evtWeek1B.frmDOV.sctDOV.itmDOV.Value,
this.evtWeek2B.frmDOV.sctDOV.itmDOV.Value,
Constants.DateTimeParts.Days)>=7

when value is false
    issue query on this.evtWeek2B.frmDOV.sctDOV.itmDOV: Date of Visit is less than a week after the Date of Visit given at Week 1. Please clarify or correct.
Alternate rule summary
evaluate on Form Submission

value = _GetDateDifference
(new DateTime(this.evtWeek1B.frmDOV.sctDOV.itmDOV.Value.Year, this.evtWeek1B.frmDOV.sctDOV.itmDOV.Value.Month, this.evtWeek1B.frmDOV.sctDOV.itmDOV.Value.Day, 00, 00, 00),
new DateTime(this.evtWeek2B.frmDOV.sctDOV.itmDOV.Value.Year, this.evtWeek2B.frmDOV.sctDOV.itmDOV.Value.Month, this.evtWeek2B.frmDOV.sctDOV.itmDOV.Value.Day, 00, 00, 00),
DateTimeParts.Days) >= 7

when value is false
    issue query on this.evtWeek2B.frmDOV.sctDOV.itmDOV: Date of Visit is less than a week after the Date of Visit given at Week 1. Please clarify or correct.
Characteristic Description

Description

Create a rule named rulDateCompareWithRange that checks that the DOV in Week 2A is within 6-8 days after the DOV in Week 1A (in Treatment Arm A).

Scope

Treatment Arm A study element

Structure

  • Week1A
    • frmDOV (form)
      • DOV (item)
  • Week2A
    • frmDOV (form)
      • DOV (item)

Rule summary

evaluate on Form Submission

value = _CompareDatesWithRange(this.evtWeek1A.frmDOV.sctDOV.itmDOV.Value,this.evtWeek2A.frmDOV.sctDOV.itmDOV.Value,Constants.DateTimeParts.Days,6,8)

when value is false
issue query on this.Week2A.frmDOV.sctDOV.itmDOV: The date of the Week 1A visit and the date of the Week2A visit are not within 6-8 days of each other. Please clarify or correct.

Alternate rule summary

evaluate on Form Submission

value = _CompareDatesWithRange(this.evtWeek1A.frmDOV.sctDOV.itmDOV.Value,this.evtWeek2A.frmDOV.sctDOV.itmDOV.Value,Constants.DateTimeParts.Days,6,8)

when value is false
    issue query on this.Week2A.frmDOV.sctDOV.itmDOV: The date of the Week 1A visit and the date of the Week2A visit are not within 6-8 days of each other. Please clarify or correct.