Home » Developer & Programmer » Forms » calculation of timing (forms 6i)
calculation of timing [message #341744] Wed, 20 August 2008 02:53 Go to next message
sajidrazmi
Messages: 47
Registered: August 2008
Location: oman
Member
Hi All
I am getiing one problem when i am going to calulate the times
i have written these code
DECLARE
  tempm   VARCHAR2 (12);
  temph   VARCHAR2 (12);
  temps   VARCHAR2 (12);
BEGIN
  Go_Block ('BLK_TAS_TEMP');
  First_Record;
  LOOP
    Go_Block ('TEMP');
    IF :BLK_TAS_TEMP.tAs_temp_Status IN ('A', 'P') THEN
      Go_Block ('TEMP');
      :TEMP.emp_Code       := :BLK_TAS_TEMP.tAs_temp_emp_Code;
      :TEMP.emp_Name       := :BLK_TAS_TEMP.tAs_temp_emp_Name;
      :TEMP.Morning_In     := :BLK_TAS_TEMP.tAs_temp_Morning_In;
      :TEMP.Lunch_Out      := :BLK_TAS_TEMP.tAs_temp_Lunch_Out;
      :TEMP.Tot_Morning    := :BLK_TAS_TEMP.tAs_temp_Tot_Morning;
      :TEMP.Post_Lunch_In  := :BLK_TAS_TEMP.tAs_temp_Post_Lunch_In;
      :TEMP.Evening_Out    := :BLK_TAS_TEMP.tAs_temp_Evening_Out;
      :TEMP.Tot_Evening    := :BLK_TAS_TEMP.tAs_temp_Tot_Evening;
      :TEMP.Tot_hrs        := :BLK_TAS_TEMP.tAs_temp_Tot_hrs;
      :TEMP.Status         := :BLK_TAS_TEMP.tAs_temp_Status;
      Next_Record;
    END IF;
    Go_Block ('BLK_TAS_TEMP');
    EXIT WHEN :SYSTEM.Last_Record = 'TRUE';
    Next_Record;
  END LOOP;
  BEGIN
    Go_Block ('TEMP');
    First_Record;
    LOOP
      BEGIN
        tempm              := (To_Date (:TEMP.Lunch_Out, 'HH:MI AM')
                               - To_Date (:TEMP.Morning_In, 'HH:MI AM'))
                              * 24
                              * 60;
        temph              := tRunc (tempm / 60);
        temps              := (tempm / 60 - tRunc (tempm / 60)) * 60;
        :TEMP.Tot_Morning  := (temph || ':' || temps);
      EXCEPTION
        WHEN OTHERS THEN
          Message (SQLERRM);
      END;
      Next_Record;
      IF :SYSTEM.Last_Record = 'TRUE' THEN
        EXIT;
      END IF;
    END LOOP;
  END;
END;

but it is not calulation the time and also exception raised and it out of the loop
please help me out
thanks and regards
[EDITED by DJM: fixed mega-crappy formatting]

[Updated on: Wed, 20 August 2008 21:24] by Moderator

Report message to a moderator

Re: calculation of timing [message #341982 is a reply to message #341744] Thu, 21 August 2008 00:25 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I don't think taht you are not processing the last record of 'TEMP' in the second loop. Put some 'message(); pause;' pairs in there to display which record you are processing and make sure that all records are handled.

David
Re: calculation of timing [message #342616 is a reply to message #341982] Sat, 23 August 2008 03:49 Go to previous message
sajidrazmi
Messages: 47
Registered: August 2008
Location: oman
Member
Thanks David
I am trying to do it.
Previous Topic: 10g form not running properly
Next Topic: Forms 10G Runtime configuration
Goto Forum:
  


Current Time: Wed Mar 12 07:55:36 CDT 2025