9 Replies Latest reply: Nov 7, 2017 7:20 AM by Michael Andersen RSS

    Script ID counter won't work

    Michael Andersen

      Hi guys

       

      I am trying to make at ID-Count in the script, but i'm not getting the right outcome.

       

      This is my script:

         Temp1:

           Load

                 VIN,

                 ServiceNo

            FROM [lib://Transform Folder/Vehicle_Ledger_Entry_20*.qvd]

           (qvd)

      ;

           Temp2:

           NoConcatenate

           LOAD *,

                if(ServiceNo > Previous(ServiceNo), Peek('ID_COUNTER') + 1, 1) as ID_COUNTER

           Resident Temp1

           ;

           DROP Table Temp1;

       

       

      This is the outcome I get:

      VINServiceNoID_COUNTERWanted outcome
      WBA1J11090VW83273SO43534011
      WBA1J11090VW83273SO48258822
      WBA1J11090VW83273SO55180613
      WBA7G4106GGE12490SO45412711
      WBA7G4106GGE12490SO52297722
      WBA7G4106GGE12490SO53004933
      WBA7G4106GGE12490SO55939944
      WBA7G4106GGE12490SO58821735
      WBA7G4106GGE12490SO60921346
      WBAZW41040L441783SO45235821
      WBAZW41040L441783SO48492622

       

      Can anyone help me get the right outcome?

       

      Many thanks :-)

       

      /Michael