Processing Only Report

LambaLamba Member Posts: 260
edited 2013-01-08 in NAV Three Tier
I have to update a field present in Purchase header, from purchase line, for that i have creatd a processing only
report. The report was created on Purchase Header.
The code on the OnAftergetRecord on Purchase Header is:

SETRANGE("No.",PurchLine."Document No.");
SETRANGE("Buy-from Vendor No.",PurchLine."Buy-from Vendor No.");
IF "Purchase Header".FINDFIRST THEN BEGIN
REPEAT
"Indent No." := PurchLine."Indent No"
UNTIL "Purchase Header"."No." <>''
END;
with DataItemTableView property as:SORTING(Document Type,No.) ORDER(Ascending)
Still the field doesn't updates on the Header. I have to update the Indent No. on the header from the Purchase line.

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    You have to take Purchase Line as dataitem..

    Will you have same Indent No. in all Purchase Lines of same Purchase Header?

    You need to write PurchaseHeader.Modify also in repeat loop..
  • LambaLamba Member Posts: 260
    now wrote the code on Purchase line:
    SETRANGE("Document No.","No.");
    SETRANGE("Buy-from Vendor No.",PurchHdr."Buy-from Vendor No.");
    IF "Purchase Line".FINDFIRST THEN BEGIN
    REPEAT
    PurchHdr."Indent No." := "Indent No";
    PurchHdr.MODIFY;
    UNTIL "Document No." <>''
    END;

    with DataItemTableView as:

    SORTING(Document No.,Line No.,Document Type) ORDER(Ascending)

    Still not working!!
  • LambaLamba Member Posts: 260
    And the indent no. remains same in all cases
  • MBergerMBerger Member Posts: 413
    Instead of fiddling with the code, tell what you want the code to do, because even that isn't completely clear.
    - What use is the indent no. on the header ?
    - What should be shown in case there is more than one line, with different indent nos. ?
    - Why do you "link" the header and the lines based on "document no." and "Buy-From Vendor no." ?
  • LambaLamba Member Posts: 260
    The indent no on line remains the same always.
    Now i have created the report on Purchase hdr and Purchase line.
    with DataItemLink of Purchase line as :Document Type=FIELD(Document Type),Document No.=FIELD(No.)

    and with following code on OnAftergetrecord of Purchase line as:


    IF "Indent No" <> '' THEN BEGIN
    "Purchase Header"."Indent No." := "Indent No";
    "Purchase Header".MODIFY(TRUE);
    END;

    and its done.

    Thanx for ur Time Guys :)
Sign In or Register to comment.