GET Function Error

toootooo Member Posts: 138
I have the below code snippet but can't seem to get it to work, gives me an error saying: "Purch. Rcpt. Hdr. No. '' does not exist."
It in the OnAfterGetRecord() trigger on the report.
PurchRcptHdr.GET;

IF ("Document No." = PurchRcptHdr."No.") THEN BEGIN
  OrderNo := PurchRcptHdr."Order No.";
  VendorOrderNo := PurchRcptHdr."Vendor Order No.";
  ShipmentNo := PurchRcptHdr."Vendor Shipment No.";
END ELSE BEGIN
  CurrReport.SKIP;
END

Answers

  • nrapendranrapendra Member Posts: 208
    send the PK value in Get function to get the appropriate record
    Nrapendra Singh
    (Sr. Tech. Consultant)
    Dataman Computer Systems (P) Ltd.
    web :www.datamannet.com
    mail :nrapendra@datamannet.com
  • garakgarak Member Posts: 3,263
    the "Purch. Rcpt. Header" has as primary key the field "No.".

    So with wich value you wan't to get the Purch. Rcpt. Header :?:


    PurchRcptHdr.GET; <- This gets an REc with an empty No.

    you need following
    PurchRcptHdr.GET(HereToNoOfTheNeededHeader);
    

    Regards
    Do you make it right, it works too!
  • toootooo Member Posts: 138
    This is what i have now, is there any preformance issues i should be concerned with here as in am i calling stuff i don't need?
    IF NOT PurchRcptHdr.GET("Document No.") THEN
      PurchRcptHdr.INIT;
    
    IF ("Document No." = PurchRcptHdr."No.") THEN BEGIN
      OrderNo := PurchRcptHdr."Order No.";
      VendorOrderNo := PurchRcptHdr."Vendor Order No.";
      ShipmentNo := PurchRcptHdr."Vendor Shipment No.";
    END ELSE BEGIN
      CurrReport.SKIP;
    END
    
  • DenSterDenSter Member Posts: 8,305
    You're thinking too complicated. When you GET the receipt with the value of "Document No.", the value is always the same, you don't need to figure out if it is the same. I'd rewire your code something like this:
    IF PurchRcptHdr.GET("Document No.") THEN BEGIN
      OrderNo := PurchRcptHdr."Order No.";
      VendorOrderNo := PurchRcptHdr."Vendor Order No.";
      ShipmentNo := PurchRcptHdr."Vendor Shipment No.";
    END ELSE BEGIN
      CurrReport.SKIP;
    END;
    
    If this is all the code in your OnAfterGetRecord, you wouldn't even have to do CurrReport.SKIP because that's the end anyway.
  • toootooo Member Posts: 138
    Appreciate the help and advice, thanks again.
Sign In or Register to comment.