Report.run (reportid, true,false,tmptable) lost the filters in navision 2016

Hi Expert.

I got a strange pb.

 

my code is below:

l_tmprecSalesHdr.DELETEALL;
CurrPage.SETSELECTIONFILTER(l_Buffer);
IF l_Buffer.FIND('-') THEN
REPEAT
IF l_recSalesHdr.GET(l_recSalesHdr."Document Type"::Order,l_Buffer."Create Order No.") THEN BEGIN
IF NOT l_tmprecSalesHdr.GET(l_tmprecSalesHdr."Document Type"::Order,l_Buffer."Create Order No.") THEN BEGIN 
l_tmprecSalesHdr :=l_recSalesHdr;
l_tmprecSalesHdr.INSERT; 
MsgTxt := MsgTxt + l_Buffer."Create Order No."; 
END; 
END;
UNTIL l_Buffer.NEXT = 0;
REPORT.RUNMODAL(50008,TRUE,FALSE,l_tmprecSalesHdr);

 

I can not get the correct result. it shows the whold data report., in fact just should show only some records based on what I selected in a page.

any suggestion will be appreciated.

  • Hi. We have come across issues with code and using GET on a table's primary key(s). So we changed to SETRANGE instead and this worked. May or may not be your issue. Hope this helps. Neil
  • I had the same issue and had to add this setrecfilter code and it took it. Your get statement is correct.

    l_tmprecSalesHdr.INSERT;
    l_tmprecsaleshdr.setrecfilter;

    REPORT.RUNMODAL(50008,TRUE,FALSE,l_tmprecSalesHdr);
  • Have you remembered to set the Temporary property to the SalesHeader in the report? Without then it will always display the actual table - not the temporary table.
  • In reply to Erik P. Ernst:

    Thanks All your reply, My question is, I need to loop a buffer table with SO NO. IN IT, what is my idea at first is that I loop the buffer table get the So No. and get related Sales header and insert into a temptable , then, I set the temptable as a fitler to a report which source table is an actual table. But my code is not work. how could I do it ? thanks very much.
  • In reply to sbhatbng:

    Thanks Sbhatbng, I tried, yes it can set one record filter to report, But i need transfer more than 1 record to report.
  • In reply to Erik P. Ernst:

    Hi Erik, I just set the temporary property to be yes in the report,But after i use my above code, i found it show empty. Why? in fact i have records in temp table.
  • In reply to Erik P. Ernst:

    Hi, Erik, I have resovled my pb. I set the temporary property to be yes, and create a function which accept the temproray table from the caller, after get the parameter temptable loop it then insert into the report's source temp table. then i can show the correct result.

    but what I don't understand, why i use page.settableview(temptable) is ok on lookup tripger of a page, But it is not ok in report ? still this issue, I have tried r50008.settableview(temptable),r5008.run , this not ok.
  • In reply to Gary:

    Personally I have always used a SET function, created in the report to move my Temporary table into the report, when the report have the Temporary property set. A "normal" run with the Temporary table doesn't work.
Related