4 Replies Latest reply: Dec 5, 2017 7:15 AM by Felip Drechsler RSS

    App is running 10 hrs due to Loops and Peek????

    Ashok N

      Hi All,

       

      I am using Loops and Peek functions to get the Last team data in Ticket history table.Logic is working fine but it runs too slow and takes 10+ hrs to complete the load.

         

      Requirement is needs to pick most recent team details only per each ticket.

       

      For more details please open attached excel where you can find sample Input and Output format.

       

      Code i written in my application is below.

       

      Ticket_History:

      Load

          TCKT_HIS_KEY_AS_NUM,

          Ticket_His_TeamName,

          START_DATE_TIME,

          END_DATE_TIME,

          Ticket_His_OpenStatus_Desc

        

      Resident    Ticket_History1

      Order by TCKT_HIS_KEY_AS_NUM,START_DATE_TIME desc , END_DATE_TIME desc;

       

       

      Let vNoOfRows = NoOfRows('Ticket_History');

       

       

      set vFlag=1;

       

       

      FOR i=0 to $(vNoOfRows)-1

        Let i1= $(i)+1;

        Let vTicketKey2=Peek('TCKT_HIS_KEY_AS_NUM',$(i),'Ticket_History');

        Let vTicketKey3=Peek('TCKT_HIS_KEY_AS_NUM',$(i1),'Ticket_History');

       

        SET vTicketKey=Peek('TCKT_HIS_KEY_AS_NUM',$(i),'Ticket_History');

        SET vTicketKey1=Peek('TCKT_HIS_KEY_AS_NUM',$(i1),'Ticket_History');

        SET vTeam=Peek('Ticket_His_TeamName',$(i),'Ticket_History');

        SET vST=Peek('START_DATE_TIME',$(i),'Ticket_History');

        SET vET=Peek('END_DATE_TIME',$(i),'Ticket_History');

        SET vStatus=Peek('Ticket_His_OpenStatus_Desc',$(i),'Ticket_History');

        SET vKey=Peek('TCKT_HIS_KEY_AS_NUM',$(i),'Ticket_History')& Peek('Ticket_His_TeamName',$(i),'Ticket_History');

        SET vKey1=Peek('TCKT_HIS_KEY_AS_NUM',$(i1),'Ticket_History')& Peek('Ticket_His_TeamName',$(i1),'Ticket_History');

       

       

        Let vKey2=AutoNumber(Peek('TCKT_HIS_KEY_AS_NUM',$(i),'Ticket_History')& Peek('Ticket_His_TeamName',$(i),'Ticket_History'));

        lET vKey3=AutoNumber(Peek('TCKT_HIS_KEY_AS_NUM',$(i1),'Ticket_History')& Peek('Ticket_His_TeamName',$(i1),'Ticket_History'));

       

       

      TestReplicate:

      LOAD  $(vTicketKey) as Ticket,

            $(vTeam) as Team,

            $(vST) as ST,

            $(vET) as ET,

            $(vStatus) as Status,

            $(vKey) AS Key,

            $(vKey1) AS Key1,

            $(vFlag) as Flag

        AutoGenerate(1);

       

      //  TRACE $(vKey2) = $(vKey3);

      If '$(vKey2)'<>'$(vKey3)' then

      set vFlag=0;

      ENDIF

       

       

      //TRACE $(vTicketKey2) = $(vTicketKey3);

      If '$(vTicketKey2)'<>'$(vTicketKey3)' then

      set vFlag=1;

      ENDIF

      //Where  $(vKey)=$(vKey1) ;

       

       

      NEXT i;

       

       

      Thanks in advance.