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.
0
Comments
Will you have same Indent No. in all Purchase Lines of same Purchase Header?
You need to write PurchaseHeader.Modify also in repeat loop..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
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!!
- 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." ?
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