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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Create a View Using "OR" & "AND"

(0) ShareShare
ReportReport
Posted on by 166

Hello

I am trying to create a View on the Customer Grid where I check 4 custom fields.

If 1 or more of the 4 fields are 0, I want to see them in the grid to be displayed,

(DLVOPEN=0) works perfectly in my custom view query.

But I need to check if any of the the other 3 fields are = 0, i.e.  something like the following : 

(DLVOPEN=0 OR DLVCLOSE=0 OR OPERATIONOPEN=0 OR OPERATIONCLOSE=0)

Is there a syntax I can use that will provide this?

Note: functional answers only thank you!

Paul

I have the same question (0)
  • Suggested answer
    Mohit Rampal Profile Picture
    12,573 Moderator on at

    Hi, I don't think it can be done without customization but happy to get corrected here. You are trying to filter on multiple fields if any any field have value zero then display record.

    You can create AND condition without customization to check if all fields are zero then display but it can be OR condition from front end.

  • Suggested answer
    GirishS Profile Picture
    27,843 Moderator on at

    Hi Paul,

    As you mentioned only functional answers, Check whether you can achieve this through "Advance filter or sort option" on the form.

    Thanks,

    Girish S.

  • Paul V Profile Picture
    166 on at

    I've tried via advanced sort filter.  If it can be done I need the syntax..  maybe via sql statement?  Again I need the syntac

  • Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    Hi, if you are using advanced filter, you can just give a comma for each value which is nothing but a or condition.

  • Verified answer
    Anton Venter Profile Picture
    21,110 Super User 2026 Season 2 on at

    The comma works for a single field but because the OR is required on different fields, a customisation is definitely required.

    learn.microsoft.com/.../using-expressions-in-query-ranges

    Google "Expressions in query ranges" for more information.

  • Mohit Rampal Profile Picture
    12,573 Moderator on at

    It can't be done by SQl scripts, you need customization in x++.  Please check below article.

    https://wp.me/p8wel1-1I

  • Paul V Profile Picture
    166 on at

    Hello.

    That would work if I was using the same field, but

    I'm using 4 separate fields and need to view the customer grid if 1 or more of these 4 fields are zero

  • Suggested answer
    Mohit Rampal Profile Picture
    12,573 Moderator on at

    It should work for different fields as well.

    queryBuildRange.value(strFmt('((%1.%2 == 0) || ((%1.%3 == 0) || (%1.%4 == 0)) || (%1.%5 == 0)))',
        query.dataSourceTable(tableNum(CustTable)).name(), // CustTable %1
        fieldStr(CustTable, DlvOpen), //  %2
        fieldStr(CustTable, DlvClose), // %3
        fieldStr(CustTable, OperationOpen), // %4
        fieldStr(CustTable, OperationClose), // %5
        

    Note: I haven't compiled code, written for reference purpose.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
SajeedMullaji Profile Picture

SajeedMullaji 312

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 284 Super User 2026 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 258 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans