Doubts in Temp recordset

chandrurecchandrurec Member Posts: 560
Dear all,

I have created a temporary record variable and then I am passing some records into that variable.The insertion of records into the temp variable, i am doing in the Onaftergetrecord trigger of the Job ledger entry dataitem.when i try to get the count in the OnPost trigger, actually i should get the count as 5 but at present i am getting as 1.

what may be the reason for this ?

based on this count i have to do some validations in the integer table which is indented under the Job ledger entry

thanks in advance.

Regards,
chandru.

Comments

  • kapamaroukapamarou Member Posts: 1,152
    Can you post here the part of your code?
  • prabhupdeshprabhupdesh Member Posts: 49
    I presume "MaxIteration" property is not set to 1 for Job ledger entry dataitem
  • chandrurecchandrurec Member Posts: 560
    Hi all,

    this is the code i have written

    LedEntDim.RESET;
    LedEntDim.SETFILTER("Table ID",'%1',169);
    LedEntDim.SETRANGE("Entry No.","Job Ledger Entry"."Entry No.");
    IF LedEntDim.FIND('-') THEN
    REPEAT
    TempLedEntDim := LedEntDim;
    TempLedEntDim.INSERT;
    TempLedEntDim2.RESET;
    TempLedEntDim2.SETFILTER(TempLedEntDim2."Table ID",'%1',169);
    TempLedEntDim2.SETRANGE(TempLedEntDim2."Dimension Code",TempLedEntDim."Dimension Code");
    IF NOT TempLedEntDim2.FIND('-') THEN BEGIN
    TempLedEntDim2.INIT;
    TempLedEntDim2.TRANSFERFIELDS(LedEntDim);
    TempLedEntDim2.INSERT;
    //MESSAGE(TempLedEntDim2."Dimension Code");
    END;
    TempLedEntDim3.RESET;
    TempLedEntDim3.SETFILTER(TempLedEntDim3."Table ID",'%1',169);
    TempLedEntDim3.SETRANGE(TempLedEntDim3."Dimension Value Code",TempLedEntDim."Dimension Value Code");
    IF NOT TempLedEntDim3.FIND('-') THEN BEGIN
    TempLedEntDim3.INIT;
    TempLedEntDim3.TRANSFERFIELDS(LedEntDim);
    TempLedEntDim3.INSERT;
    //MESSAGE(TempLedEntDim3."Dimension Value Code");
    END;
    Cnt:=Cnt+1;
    UNTIL LedEntDim.NEXT=0;

    Regards,
    chandru.
  • chandrurecchandrurec Member Posts: 560
    Hi PrabubDesh,

    I have not set the MAxIteration property to 1 but still i am getting the count as 1 and not the actual count. the code which i have written is pasted above please have a look at the code and tell where the mistake lies?

    If you dont mind please give me ur gmail id so that we can chat ober gtalk.

    Regards,
    chandru.
  • bbrownbbrown Member Posts: 3,268
    Call RESET on your temp record variable before calling COUNT.
    There are no bugs - only undocumented features.
  • chandrurecchandrurec Member Posts: 560
    Hi bbrown,


    can u explain me why we have to put reset on the tempvariable before calling count.

    Regards,
    chandru.
  • bbrownbbrown Member Posts: 3,268
    So that the temo record variable sees all records in the table, not just the last one inserted
    There are no bugs - only undocumented features.
  • kinekine Member Posts: 12,562
    chandrurec wrote:
    Hi bbrown,


    can u explain me why we have to put reset on the tempvariable before calling count.

    Regards,
    chandru.
    Because you need to be sure that there are no filters applied to the variable to do count of all records, not only the one which is inside the filter... ;-) (as bbrown described)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.