Duplicate values check - table section items

Check if more than one table instance contains the same value for a given item in a respective two-section form.

Rule description: issue a query if a duplicate Abnormality/Condition is entered in the Medical History table section.

Rule expression

var instval=getCurrent2SFormInstance();
if(findDuplicate2SForm(instval,MHCondition))
{
   return false;               //System sends query when return false condition is met
}
else
{
    return true;
}

Query Message: Abnormality/Condition has been recorded in duplicate, please verify and correct.

Definitions

MHCondition

Corresponds to the Abnormality/Condition that is present in the table section of a two-section form, from rule description.

getCurrent2SFormInstance( )

Gets the form instance number of the current two-section form.

findDuplicate2SForm( )

Identifies duplicated data as item values for the variables provided as parameters, in this case lesid.

Return value

Boolean

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

Usage tips

Use this when an item is not a choice control.

Verification steps

  1. Using a subject for testing, go to the given visit and form containing the iems to check, in this example the Abnormality/Condition <MHCondition> in the specified table instance of the Medical History two-section form.
  2. Update the form item MHCondition as in the following table and verify the result is as listed:
    Step Notes Result

    a. In the first two-section form instance (Form1), create a first table instance (Row1) and enter the MHCondition item as 'value 1'.

    Only one two-section form instance.

    No query.

    b. In Form1, create a second table instance (Row2) and enter the MHCondition item as 'value 1'.

    Matching values in Row1 and Row2 of Form1:
    • Form1:
      • Row1 - value 1
      • Row2 - value 1

    Query.

    c. Update MHcondition item in Row2 of Form1 as 'value 2'.

    Different values in Row1 and Row2 of Form1:
    • Form1:
      • Row1 - value 1
      • Row2 - value 2

    No query.

    d. Update MHcondition item in Row1 of Form1 as 'value 2'.

    Matching values in Row1 and Row2 of Form1:
    • Form1:
      • Row1 - value 2
      • Row2 - value 2

    Query.

    e. Clear MHCondition item in Row2 of Form1.

    Different values in Row1 and Row2 of Form1:
    • Form1:
      • Row1 - value 2
      • Row2 - Null

    No queries.

    f. Update MHcondition item in Row2 of Form1 as 'value 3'.

    Different values in Row1 and Row2 of Form1:
    • Form1:
      • Row1 - value 2
      • Row2 - value 3

    No queries.

    g. In Form1, create a third table instance (Row3) and enter the MHCondition item as 'value 2'.

    Matching values in Row1 and Row3 of Form1:
    • Form1:
      • Row1 - value 2
      • Row2 - value 3
      • Row3 - value 2

    Query.

    h. Update MHcondition item in Row3 of Form1 as 'value 1'.

    Different values in Row1, Row2 and Row3 of Form1:
    • Form1:
      • Row1 - value 2
      • Row2 - value 3
      • Row3 - value 1

    No queries.

    i. Update MHcondition item in Row3 of Form1 as 'value 3'.

    Matching values in Row2 and Row3 of Form1:
    • Form1:
      • Row1 - value 2
      • Row2 - value 3
      • Row3 - value 3

    Query.

    j. Create a second two-section form instance (Form2) and create a first table instance (Row1) and enter the MHCondition item as 'value 3'.

    Matching values in Matching values in Row2 and Row3 of Form1:
    • Form1:
      • Row1 - value 2
      • Row2 - value 3
      • Row3 - value 3
    • Form2:
      • Row1 - value 3

    Query in Form1.

    No query in Form2.

    k. In Form2, create a second table instance (Row2) and enter the MHCondition item as 'value 3'.

    Matching values in Matching values in Row2 and Row3 of Form1 and in Row1 and Row2 of Form2:
    • Form1:
      • Row1 - value 2
      • Row2 - value 3
      • Row3 - value 3
    • Form2:
      • Row1 - value 3
      • Row2 - value 3

    Query in Form1 and Form2.

    l. Delete Row2 in Form2.

    Matching values in Matching values in Row2 and Row3 of Form1:
    • Form1:
      • Row1 - value 2
      • Row2 - value 3
      • Row3 - value 3
    • Form2:
      • Row1 - value 3

    Query in Form1.

    No query in Form2

Note:

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

Other examples

Example 4-31 If Timepoint (or Visit) is selected and previous record already uses timepoint, then fire query

var frminst=getCurrent2SFormInstance();
if(findDuplicate2SForm(frminst,Visit))
{
return false;
}
else
{
return true;
}

Query message: The time point selected has already been reported on a previous record. Please review and reconcile.

Example 4-32 Date of Assessment cannot be duplicated. For example, if 01/01/2021 is already recorded for a previous Timepoint, it cannot be recorded again

var frminst=getCurrent2SFormInstance();
if(findDuplicate2SForm(frminst,assdt))
{
return false;
}
else
{
return true;
}

Query message: Date of Assessment is already recorded. Please review and correct.