Updating of Field

niimodinniimodin Member Posts: 142
Hello Experts,
I have a some field with are flowfield but when I look for the record to update other field it doesn't work.
The flowfield appear to be zero.
My code is below
Can someone tell me what I did wrong?
PayrollBuffer.CALCFIELDS(PayrollBuffer."Consolidated Allowances",PayrollBuffer."Bonus Taxable Surplus");


IF PayrollBuffer.GET(Year,Month,StaffID) THEN BEGIN
   PayrollBuffer."Gross Salary" := PayrollBuffer."Basic Salary"+PayrollBuffer."Consolidated Allowances"+
                                   PayrollBuffer."Overtime Taxable Surplus"+ PayrollBuffer."Night Taxable Surplus"+
                                   PayrollBuffer."Bonus Taxable Surplus";
   PayrollBuffer.MODIFY;
END;

Comments

  • DenSterDenSter Member Posts: 8,305
    Try this:
    IF PayrollBuffer.GET(Year,Month,StaffID) THEN BEGIN
       PayrollBuffer.CALCFIELDS(PayrollBuffer."Consolidated Allowances",PayrollBuffer."Bonus Taxable Surplus");
       PayrollBuffer."Gross Salary" := PayrollBuffer."Basic Salary"+PayrollBuffer."Consolidated Allowances"+
                                       PayrollBuffer."Overtime Taxable Surplus"+ PayrollBuffer."Night Taxable Surplus"+
                                       PayrollBuffer."Bonus Taxable Surplus";
       PayrollBuffer.MODIFY;
    END;
    
  • BeliasBelias Member Posts: 2,998
    You should move the calcfields instruction after the get
    ...whops, mibuso didn't notice me of an existing reply :?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • niimodinniimodin Member Posts: 142
    Thank you all
Sign In or Register to comment.