Configuring a check to apply to a specific event or activity

  • Published by Viedoc System 2024-04-29
  • Print

Write an edit check for Events and Dates

If the same form is used within different events (for example Event1, Event2 and Event3), and we want to configure an edit check (for example, DATE1 must be before DATE2) only for a specific event (for example Event3), this can be done using the following code (it is always recommended to check for NULL before referring to the dates):

if(StudyEventDefId == "Event3" && DATE2!=null && DATE1!=null)
return DATE2>=DATE1;
else return true;

This will perform the check only for Event3.

Similarly, if we want to perform the check only for a particular activity (ACT1) within Event3, we can use the following code:

if(ActivityDefId == "ACT1" && DATE1 != null && DATE2 != null)
return DATE1<=DATE2;
else return true;