Boolean filter on record before report.runmodal

NagiNagi Member Posts: 151
edited 2014-09-11 in NAV Three Tier
Hello NAV experts!
I am trying to set a boolean filter on a field and then call report.runmodal with the record variable. Basically I want a default boolean filter to be true when a report is run. The thing is that NAV doesn't seem to save the boolean filter. Other filters are saved, like if you set filter on a code field, but not if you set filter on a boolean field.
SalesHeader.SETRANGE("Document Type",SalesHeader."Document Type");
SalesHeader.SETRANGE("No.",SalesHeader."No.");
SalesHeader.SETRANGE("Sell-to Customer No.",SalesHeader."Sell-to Customer No:");
SalesHeader.SETRANGE("My Boolean Field",TRUE);
REPORT.RUNMODAL("My Report ID",GUIALLOWED,FALSE,SalesHeader);

The filters on document type, no. and sell-to customer no. are all present when the report is run, but the filter on my boolean field is lost. Does anybody know why this is so? This is NAV 2013 R2 build # 7.1.37563.0

Comments

  • tinoruijstinoruijs Member Posts: 1,226
    Probably has something to do with the use of two times Salesheader.

    Maybe you should change it to:
    SalesHeader2.SETRANGE("Document Type",SalesHeader."Document Type");
    SalesHeader2.SETRANGE("No.",SalesHeader."No.");
    SalesHeader2.SETRANGE("Sell-to Customer No.",SalesHeader."Sell-to Customer No:");
    SalesHeader2.SETRANGE("My Boolean Field",TRUE);
    REPORT.RUNMODAL("My Report ID",GUIALLOWED,FALSE,SalesHeader2);
    

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • NagiNagi Member Posts: 151
    Hello and thank you for your reply. :D I should specify that the record SalesHeader has values, so using those values to set filter on the fields should be ok. My modification is to codeunit 229 and function PrintSalesOrder. I have tried changing it to SalesHeader2, but the result is the same. I'm suspecting that this is a bug in 2013 r2 ](*,) ](*,) ](*,)
Sign In or Register to comment.