Examples--Using the Current() method and IsValueInArray function

The following examples show the following:

  • Rule expressions that use the Current() rule method.
  • For each correct rule expression that uses the Current() method, an alternative rule expression that uses the IsValueInArray function. Each example that uses the IsValueInArray function is correct, and passes validation.

The examples use the following abbreviations for study objects:

  • evt—Study event
  • frm—Form
  • sct—Section
  • int—Integer item
  • float—Float item
  • yn—Yes/No codelist

Example—Data-entry rule:

Rule expression Correct—Rule passes validation Incorrect—Validation error occurs

Data-entry rule

this.frm1a.Current().int1.Value == 1

query on this.frm1a.Current().sctbc.float1: query text

query on this.frm1.float1: query text

Data-entry rule using an array

this.frm1a.int1.Values.Count>0 && Functions._IsValueInArray(1,this.frm1a.int1.Values) == true

query on this.frm1a.Current().sctbc.float1: query text

N/A

query on this.frm1.float1: query text

N/A

Example—Workflow rule:

Rule expression Correct—Rule passes validation Incorrect—Validation error occurs

Workflow rule

this.evt6.Current().frm2a.sct2b.yn2.Value == this.evt6.Current().frm2a.sct2b.yn2.YesNoCodelist2.YesCodelistItem2

You can use this rule expression to trigger a form in study event evt6.

You cannot use this rule expression to trigger a form in a study event other than evt6.

Workflow rule using an array

this.evt6.frm2a.sct2b.yn2.AllValues.Count>0 && Functions._IsValueInArray(this.evt6[0].frm2a[0].sct2b[0].yn2.YesNoCodelist2.YesCodelistItem2,this.evt6.frm2a.sct2b.yn2.AllValues)==true

You can use this rule expression to trigger any study event.

N/A

Example—Global condition:

Rule expression Correct—Rule passes validation Incorrect—Validation error occurs

Global condition

this.evt1a.Current().frm3.yn1.Value == this.evt1a.Current().frm3.yn1.YesNoCodelist.YesCodelistItem

You can use this rule expression to trigger form frm1 in study event evt1a.

You cannot use this rule expression to trigger form frm1 in a study event other than evt1a.

Global condition using an array

this.evt1a.frm3.yn1.Values.Count>0 && Functions._IsValueInArray(this.evt1a[0].frm3.yn1.YesNoCodelist.YesCodelistItem,this.evt1a.frm3.yn1.Values)== true

You can use this rule to trigger:

  • Form frm1 in study event evt1a
  • Form frm1 in study event evt2

N/A