Perform Authomatic Calculation on tables.

kolaboykolaboy Member Posts: 446
I have a table with employee ID, timein, timeout and total time columns. I have imported the ID, timein and timeout column. The total time is not imported and it is zero. But when i modify any value on either the timein or timeout, then the total time is calculated.Doing this for 1000's of records could be tidious.

Is there any way i can do this on a large record very fast?

thanks

Comments

  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    But when i modify any value on either the timein or timeout, then the total time is calculated.
    Based on above info I assume that "Total Time" calculation code is there on the OnValidate() of timein, timeout fields. If so, Try following
    //EmpAttendance is a Rec data type for your Imported Table
    
      EmpAttendance.RESET;
      if EmpAttendance.FINDSET then
      repeat
         EmpAttendance.VALIDATE(timeout);
         EmpAttendance.MODIFY(true);
      until EmpAttendance.NEXT = 0;
    

    O:)
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
  • kolaboykolaboy Member Posts: 446
    I used the code below to create a code unite. When i click on run, i have an error which says "The time is not Valid"
    Here is the code:
    Stafftimesheet.RESET;
      IF Stafftimesheet.FINDSET THEN
      REPEAT
         Stafftimesheet.VALIDATE("Time Out");
         Stafftimesheet.MODIFY(TRUE);
      UNTIL Stafftimesheet.NEXT = 0
    

    what could be the problem?
    Thanks
  • kolaboykolaboy Member Posts: 446
    I got it working now. Thanks to all.
Sign In or Register to comment.