Hello!
I have this code under the Release action button:
Release - OnAction()
IF PurchaseHeader.GET("Document Type","No.") THEN BEGIN
PurchaseHeader.TESTFIELD("Purchase Contract"); //checks if the purchase contract field is filled
PurchaseHeader.TESTFIELD("Posting Date"); //checks if the posting date field is filled
VendorPurchaseContract.GET(PurchaseHeader."Buy-from Vendor No.");
VendorPurchaseContract.GET();
VendorPurchaseContract.TESTFIELD("Begin Date"); //need these 2 to be filled for the next if sentence
VendorPurchaseContract.TESTFIELD("End Date");
//PurchaseHeader.SETFILTER("Posting Date",'%1..%2', VendorPurchaseContract."Begin Date",VendorPurchaseContract."End Date");
IF (PurchaseHeader."Posting Date" >= VendorPurchaseContract."Begin Date") AND //check if posting date between
(PurchaseHeader."Posting Date" <= VendorPurchaseContract."End Date") THEN BEGIN
VendorPurchaseContract.TESTFIELD(Sum); //checks if the Sum field is filled
IF (PurchaseHeader."Amount Including VAT" <= VendorPurchaseContract.Sum) THEN //no release before the final condition is met
ReleasePurchDoc.PerformManualRelease(Rec);
END;
END;
Debugger shows that the line VendorPurchaseContract is '', but actually I have 6 records/lines for that. Anyone know what the problem could be?
0
Answers
why do you need 2 GET statements?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
The primary key is "Vendor No." for that table. Because I've come to the understanding that I need the "Buy-from Vendor No." from PurchaseHeader and the "Vendor No." from VendorPurchaseContract table to read in the data. Also, the error message I get is that "The entry for VendorPurchaseContract does not exist. Fields and values: Buy-from Vendor No. = '<current Buy-from Vendor No.>' " It seems that the VendorPurchaseContract record is <Uninitialized>.
Manually filter the primary key field with the vendor number and you will not see a record.
Yes, that's where I'm confused. So the record in VendorPurchaseContract."Vendor No." should be valued with/equal to PurchaseHeader."Buy-from Vendor No."?