Options

Job journal totals

EdWilliamsEdWilliams Member Posts: 7
I have this code in the onopenpage of job journal page 201 which works fine to update changes in job journal.
But I also want it updated live, while the user is doing the changes. I've tried placing this code in onaftergetrecord but it just sets it to 0 and makes it worse. How do I make this work?


Totalcost := 0;
REPEAT
Totalcost := JobJournalLine."Total Cost" + Totalcost;
UNTIL JobJournalLine.NEXT = 0;

Answers

  • Options
    EdWilliamsEdWilliams Member Posts: 7
    NVM I GOT IT:




    JobJournalLine.SETRANGE("Journal Template Name",'JOB');
    JobJournalLine.SETRANGE("Journal Batch Name", CurrentJnlBatchName);


    IF JobJournalLine.FIND('-') THEN
    Totalcost := 0;
    REPEAT
    Totalcost := JobJournalLine."Total Cost" + Totalcost;
    UNTIL JobJournalLine.NEXT = 0;
  • Options
    RockWithNAVRockWithNAV Member Posts: 1,139
    Hey EdWilliams ,

    Just to add one thing, Always use FINDFIRST instead of FIND('-'), though both are same but as far optimization point of view FINDFIRST is much better. Secondly whenever use REPEAT UNTIL always use FINDSET instead of FINDFIRST.
Sign In or Register to comment.