how to use calcfields

viswanathviswanath Member Posts: 24
edited 2008-01-02 in Navision Attain
hai all

i calculated the total absences(flow field) of an employee with the filters employee no and month.
and i want to use this flow field to calculate the paid days(total days per month - employee absences for that month)
i know that flow fields are virtual fileds , and tried with calcfields function to update
but unable to worked it out
can any one help me in this senario
Thanks in advance

Comments

  • kinekine Member Posts: 12,562
    For that you cannot use flowfield. You need to use function for that. You need to take count of workdays in the month and subtract the absence.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,115
    If you use it directly on the table in which the data is, you need to use CALCSUMS(...);

    E.g.
    recAbsences.RESET;
    recAbsences.SETCURRENTKEY("The Key you need");
    recAbsences.SETRANGE("Employee No.",codTheEmployee);
    recAbsences.SETRANGE("Some Date",datDateFrom,datDateTo);
    recAbsences.CALCUMS("Absence Field");
    MESSAGE('The employee has been absent for %1 days',recAbsences."Absence Field");
    

    If you have a flowfield in Employee that points to this table, you need to do this:
    recEmployee.GET(codTheEmployee);
    recEmployee.SETRANGE("Date Filter",datDateFrom,datDateTo);
    recEmployee.CALFIELDS("Absence Field");
    MESSAGE('The employee has been absent for %1 days',recEmployee.Absence Field");
    
    [/code]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • kinekine Member Posts: 12,562
    Kriki, it is about something else... :whistle: :mrgreen:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,115
    kine wrote:
    Kriki, it is about something else... :whistle: :mrgreen:
    I just continued on the information that was provided. That let me think there was a field with a decimal in it to be totaled over a larger period.

    Or maybe I didn't recover from the End-Year-Party. :mrgreen:
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.