Hi all,
I want to fetch the "Vendor Name" on "Posted Transfer Shipment Report", so i have added a field "vendor No." on Transfer Header and Transfer Shipment Header" with Table Relation as Vendor.
The field "Vendor No." is getting updated on post of the Transfer Order in Transfer Shipment Header table for that i have made changes to the code unit 5704
(TransShptHeader."Vendor No.":="Vendor No.";)
Now i want to fetch the Vendor Name on the "Posted Transfer Shipment" Report, so i have written the following code under OnPresection of "Transfer Shipment Line" Body section.
Following globals i have created:
TransShipLine->Record->Transfer Shipment Line
TransShipHeader->record->Transfer Shipment Header
VendorRec->Record->Vendor
VendorName->Text
//TransShipLine.RESET;
//TransShipLine.SETRANGE(TransShipLine."Document No.",TransShipHeader."No.");
IF VendorRec.GET(TransShipHeader."Vendor No.") THEN
VendorName:=VendorRec.Name;
But i am not able to fetch the Vendor Name,
Can anybody suggest me what is wrong with this code.
0
Comments
use if TransShipLine.findset then before vendorrec.get.
hi,
its done
what i did is , i wrote
IF VendorRec.GET("Transfer Shipment Header"."Vendor No.") THEN
instead of
IF VendorRec.GET(TransShipHeader."Vendor No.") THEN
its working, but i am not clear why [IF VendorRec.GET(TransShipHeader."Vendor No.") THEN]
is not working
i think that "Transfer Shipment Header" is instead the dataitem of your report, thus is automatically read by NAV.
TIP: do not put code in the report sections, even if it is only for visibility purposes (e.g.: SHOWOUTPUT function), instead, in your case, you can put it under the onaftergetrecord trigger: in this way you will not shatter the code everywhere in the report.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Thanx for the suggestion
because you didn't initialize TransShipHeader variable with a proper get or find...(this means that you don't have any value in Transshipheader."vendor no.", and your "GET" fails)
i think that "Transfer Shipment Header" is instead the dataitem of your report, thus is automatically read by NAV.
TIP: do not put code in the report sections, UNLESS if it is only for visibility purposes (e.g.: SHOWOUTPUT function), instead, in your case, you can put it under the onaftergetrecord trigger: in this way you will not shatter the code everywhere in the report.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog