web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Boolean Check

(0) ShareShare
ReportReport
Posted on by


IF (TaxFilter NOT True) or (TaxFilter NOT False) then begin
SalesInvoiceHeader.SETCURRENTLEY(SalesInvoiceHeader."No.");
IF SalesInvoiceHeader.GET("Job WIP G/L Entry"."Document No.") THEN;
IF TaxFilter <> SalesInvoiceHeader."Tax Liable" THEN
CurrReport.SKIP;
END;

WHAT IS WRONG WITH THIS?  

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    What are you expecting from this line of code? can you please explain?

    IF (TaxFilter NOT True) or (TaxFilter NOT False) then begin

    Generally IF TaxFilter THEN itself means Taxfilter = TRUE

    IF not TAXFilter THEN means TaxFilter = FALSE

  • Community Member Profile Picture
    on at

    I am trying to put filter on the job cost by department report.  TaxFilter is a request form field (Boolean)  and it is compared to the Sales Invoice Header. Tax Liable field (Boolean).  I was not sure if a Boolean field can be blank (not selected)?  So I was checking for that occurrence, however in the code and stepping through the debugger, the TaxFilter field is either true or false, and the sales invoice header tax liable field is yes or no.

  • Suggested answer
    jcastro Profile Picture
    2,245 on at

    If both fields have the same datatype you should be able to compare them against each other without an issue. If the "Tax Liable" field is an "Option" field, you will have to create something like this:

    boolTaxLiable (boolean variable)

    boolTaxLiable := SalesInvoiceHeader."Tax Liable"::"Yes";

    //IF TaxFilter <> SalesInvoiceHeader."Tax Liable" THEN - COMMENTED

    IF TaxFilter <> boolTaaxLiable THEN

    [...]

    If this does not work could you ellaborate a bit further?

  • Verified answer
    Suresh Kulla Profile Picture
    50,247 Super User 2025 Season 2 on at

    Since Tax filter is a boolean,  it could be either true or false so you don't need to check if it is true or false, as Mohana mentioned the correct way to check that is

    IF (TaxFilter) or (NOT TaxFilter) -- But you need to check this.

  • Community Member Profile Picture
    on at

    Ok I got that part; so I will have a request form variable i.e., taxfilter and if taxfilter is true then I only want to get job records where the sales invoice tax liable field is true.  The same goes for false. I would put in the Sales Invoice Header after record; if tax liable<> sales invoice header, currReport.skip  Make sense?

  • Suggested answer
    jcastro Profile Picture
    2,245 on at

    In case that the Tax Liable field of the SalesInvoiceHeader is a boolean, you could do as follows in the onpredataitem of the report.

    Tax Liable is boolean

    SalesInvoiceHeader.SETRANGE("Tax Liable",TaxFilter);

    In case that Tax Liable is option

    IF TaxFilter THEN

     "SalesInvoiceHeader".SETRANGE("Tax Liable",SalesInvoiceHeader."Tax Liable"::Yes)

    ELSE

     "SalesInvoiceHeader".SETRANGE("Tax Liable",SalesInvoiceHeader."Tax Liable"::No);

    You should consider filtering out the records that you do not want to work with (the ones you wanna skip) instead of skipping them. Not retrieving them is always more efficient than reading them and doing nothing with them after :-)

  • Suggested answer
    Suresh Kulla Profile Picture
    50,247 Super User 2025 Season 2 on at

    Your logic works but as Jose mentioned instead of retrieving it apply the filter in the OnPreDataItem trigger of Sales Invoice Header dataitem

    SETRANGE("Tax Liable",TaxFilter);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans