4 Replies Latest reply on Apr 30, 2015 11:59 AM by 1047190

    Skip in import format

    1047190

      Hi Everyone

       

      We have a requirement our source file is CSV file ( Delimter file) in that we have below records

       

      Account     Currency        Costcenter          Amount

       

      1001         USD              C001                  1000

       

      1002         INR               C002                   2000

       

      1003         EUR             C003                   3000

       

       

      From the above data we want only USD  data records  to be imported in FDM .like this

       

      1001     C001       1000

       

      In import format i have used skip  and  i have written import script  for Skip like this

       

      Dim strAccount

       

      'Store first value of account

      strAccount = strField

       

      'Check to see if value is empty

      If strAccount = "INR","EUR' Then

      'Skip Line

      Res.PblnSkip=True

      Else

      AccountEmptySkip=strAccount

      End if

       

      End Function

       

      When i am importing its importing all the records . its not skipping INR and EUR records

       

      Can anyone help me in resolving this

        • 1. Re: Skip in import format
          SH_INT

          Your condition syntax is incorrect meaning it will never evaluate to True. It should be:

           

          If strAccount = "INR" OR strAccount = "EUR' Then


          Also what are you trying to do in the script, the values you are evaluating are from the currency field in the file yet you assign them to a local variable called strAccouunt which is somewhat confusing. Are you trying to return the Account value conditionally based on the value in the Currency field or the Currency field conditionally based on the value in the Currency field i.e. what value are you passing into the function as the strField parameter - if it is Account the script will not work as it will never evaluate correctly against the currency criteria.

          • 2. Re: Skip in import format
            1047190

            Thanks for the quick reply SH

             

            We don't have currency dimension Filed in the import format. below are examples of our source file and import format

            Currency column is in source file , but it will not be in import format

             

            Account     Currency        Costcenter          Amount

             

            1001         USD              C001                  1000

             

            1002         INR               C002                   2000

             

            1003         EUR             C003                   3000

             

            Field Name            Field  Number    Numberof Fields           Expression

            Account                    1                      4

            CostCenter                3                      4

            Amount                     4                       4

            Skip                          2                       4                             Script=Skip.uss

             

            After your reply i have corrected my script and written below script

             

            Dim strSkip

            strSkip = strField

            If strSkip = "INR" OR strAccount = "EUR' Then

            SelectCADLines=strSkip

            Else

            Res.PblnSkip=True

            End if

             

            now also its importing all the records it not skipping INR AND USD records data

             

            Can you please explain me now how to resolve this issue

            • 3. Re: Skip in import format
              SH_INT

              The problem here is that you are mixing up implementations of the Skip function. You can only specify Skip in the Import Format Field Name for Fixed Length files, where it will then Evaluate the expression to see if it matches the specified set of characters in the file. For Delimited files you need to use an import script and evaluate and apply the Skip criteria there.

               

              What you need to do is the following:

              1) Change your import format to the below

              Field Name            Field  Number    Numberof Fields           Expression

              Account                    1                           4                               Script=Skip.uss

              CostCenter                3                           4

              Amount                     4                            4                                       

              2) Edit the Skip.uss script as follows:

              Dim strSkip

              strSkip = DW.Utilities.fParseString(strRecord,4,2,",")

              If strSkip = "INR" OR strAccount = "EUR' Then

                   SelectCADLines=strField

              Else

                   Res.PblnSkip=True

              End if

               

              This assumes your file is delimited by commas, if not change the delimiter (in bold) on the 2nd line of the above script to whatever you are using as the delimeter in your source file.

              • 4. Re: Skip in import format
                1047190

                Thanks for the help it worked