Function PrintRecords on table 6660 Return Receipt Header

rob_keizersrob_keizers Member Posts: 11
edited 2005-03-30 in Navision Attain
Hi!

The function looks like this:

WITH ReturnRcptHeader DO BEGIN
COPY(Rec);
ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"S.Ret.Rcpt.");
ReportSelection.SETFILTER("Report ID",'<>0');
ReportSelection.FIND('-');
REPEAT
REPORT.RUNMODAL(ReportSelection."Report ID",ShowRequestForm,FALSE,ReturnRcptHeader);
UNTIL ReportSelection.NEXT = 0;
END;

and is called from e.g. from 6660 Posted Return Receipt.

I would like to call different reports depending on the field 'Ship-to Country Code' which is on the table 6660 Return Receipt Header. Like this:

WITH ReturnRcptHeader DO BEGIN
COPY(Rec);
IF ReturnRcptHeader."Ship-to Country Code" = 'NL' THEN
REPORT.RUNMODAL(50026,ShowRequestForm,FALSE,ReturnRcptHeader)
ELSE
REPORT.RUNMODAL(50029,ShowRequestForm,FALSE,ReturnRcptHeader);
END;

Unfortunately this C/AL Global (ReturnRcptHeader) is empty and my IF-statement won't work.

How come?
Greetings,

Rob Keizers
Pulse Automation Experts B.V.

Comments

  • SbhatSbhat Member Posts: 301
    You should first copy the record to returnrecptheader and it would work. Attached is the code below and your logic should work.

    returnrcptheader. COPY(Rec);
    WITH ReturnRcptHeader DO BEGIN

    IF ReturnRcptHeader."Ship-to Country Code" = 'NL' THEN
    REPORT.RUNMODAL(50026,ShowRequestForm,FALSE,ReturnRcptHeader)
    ELSE
    REPORT.RUNMODAL(50029,ShowRequestForm,FALSE,ReturnRcptHeader);
    END;


    SB.
Sign In or Register to comment.