1 Reply Latest reply on Feb 25, 2013 4:04 PM by SH_INT

    Import Script to Ignore Certain Entities

    user3027589
      Need help with a script. I am trying to ignore certain entities from the source file on import using an import script. The script below is successful at ignoring 3000 but is not ignoring NORTH. I am guessing that it is having a problem with the text. Any ideas how to solve?


      'Declare Variables
      Dim strEntity

      'Store the Entity as Column 3 of 15 of a tab delimited file
      strEntity = Trim(DW.Utilities.fParseString(strField, 15, 3, "     "))

      If Not strEntity = "3000" Or Not strEntity = "NORTH" Then

      'Skip the record
      RES.PblnSkip = True
        • 1. Re: Import Script to Ignore Certain Entities
          SH_INT
          I can see a number of issues with your script:

          1) You shouldn't need the DW.Utilities.fParseString function if your import script is asscoiated with the Entity field in your Import format. Just reference strField

          2) If it is associated with another field then the function as written below will not work as the first argument in the function should be strRecord NOT strField

          3) If the assignment of the strEntity variable was corrected, how the rest of the script is written below ...

          If Not strEntity = "3000" Or Not strEntity = "NORTH" Then

          'Skip the record
          RES.PblnSkip = True

          ... would skip all entities as if either condition is True the result is True

          To Ignore Entity 3000 and NORTH you would have to write the If Statement like this ...

          If strEntity = "3000" Or strEntity = "NORTH" Then
          'Skip the record
          RES.PblnSkip = True
          End If

          4) The comparison will be case sensitive. So its good practice to force the incoming field to be uppercase for string comparisons so this will not be an issue i.e. UCase(strEntity) = "NORTH"