AnsweredAssumed Answered

Script Wording for PatternCount List Comparison is Not Working

Question asked by ezellkendrick on Feb 2, 2015
Latest reply on Feb 3, 2015 by ezellkendrick

Title

Script Wording for PatternCount List Comparison is Not Working

Post

Hello,

The following script is to compare a name in Table 1 to a list of names in Table 2 to ensure that a duplicate name is not being added to Table 2. When the Id in Table 1 is compared to a record with the same Id In Table 2 it works correctly, but when the Name is compared with the an Else If statement it doesn't find matching names. I have my relationship set as follows:

Table 1 Id = Table 2 Id_Fk

and

Table 1 First Name  = Table 2 First Name

and

Table 1 Last Name  = Table 2 Last Name

 

Set Variable [ $Name; Value:PrimaryList::Name_First ]


Set Variable [ $Id; Value:PrimaryList::Id_Primary ]


If [ PatternCount ( List ( NamesList::Id_ Fk) ;$Id) ]

Show Custom Dialog [ Title: "Name Exists Exit Script"; Message: "Name Exists "; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]

Exit Script [ ]


Else If [ PatternCount ( List ( NamesList::Name_First) ;$Name) ]

Show Custom Dialog [ Title: "Name Exists Exit Script"; Message: "Name Exists "; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]

Go to Related Record [ From table: “NamesList”; Using layout: “Names Pick List” (NamesList) ] [ Show only related records; New window ]

Show/Hide Toolbars [ Toggle ]


Pause/Resume Script [ Indefinitely ]

End If

Outcomes