Skip to main content
OCLC Support

Validate

Find the syntax, use, parameters, return values, and an example for the Validate macro command in Connexion client.
Syntax nNumErrors = CS.Validate (sErrorList)
Use to Validate the current record, or records selected in a list, and return a list of validation errors, if any.

Same as using the Edit > Validate menu command.
Parameters Enter the parameter sErrorList to store a list of validation errors, if any.
Comments
  • Errors in the list are separated by a pipe character ( | ).
  • You must be logged on to validate records.
  • When you validate a record, the client automatically saves it, whether the validation is successful or not.
Return values An integer showing the number of validation errors.

 Note: A return of -1 indicates that validation failed because of a system error.

Example Sub Main()

     Dim CS As Object
     Dim sErrorList As String
     Dim sError As String
     Dim nNumErrors As Integer
     Dim nIndex As Integer

     Set CS = GetObject(,“Connex.Client”)

     If CS.IsOnline = False Then
          CS.Logon ““, ““, ““
     End If

     CS.Search “WC”, “#1” ‘ Create 2 invalid fields
     CS.AddField 1, “100aa100 field”
     CS.AddField 1, “500bb500 field”

     nNumErrors = CS.Validate(sErrorList)

     If nNumErrors > 0 Then
          MsgBox “There were “ + (nNumErrors) +
          “ validation errors”

     ‘ Display all of the validation errors
     MsgBox sErrorList

     ‘ Display the errors individually
     nIndex = Instr(sErrorList, “|”)

     While nIndex > 0
          MsgBox Left(sErrorList, nIndex + 1)

          sErrorList = Mid(sErrorList, nIndex + 1)
          nIndex = InStr(sErrorList, “|”)
     Wend

     MsgBox sErrorList
  End If
End Sub

What this example does
  • Logs on to Connexion if not already logged on, using the default authorization and password you selected in Tools > Options > Authorizations tab.
  • Searches WorldCat for record number 1.
  • Adds two invalid fields: a new first instance of field 100--with invalid indicators aa and the text: 100 field--and a new first instance of field 500--with invalid indicators bb and the text: 500 field.
  • Runs validation on the record and returns the number of errors (two in this case).
  • Sends the message: There were 2 validation errors.
  • Displays each validation error individually.
  • Returns a list of errors separated by the pipe (|) character (in this case two errors about invalid indicators).