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 :
Microsoft Dynamics AX (Archived)
Answered

Filtering out for multiple values in query range using addrange

(0) ShareShare
ReportReport
Posted on by

Hello,

I'm trying to filter out for two values. In SQL this would be where prodtable.fieldname not in ('hold', 'delete')

I have the two lines below, but it acts as an "or" operator. I need the two lines only using an "and" operator

Thanks in advance for any help you can provide

qbdsProdTable.addRange(fieldNum(ProdTable,ProdPoolId)).value(queryNotValue(BOT_ProdPoolID::Hold ));

qbdsProdTable.addRange(fieldNum(ProdTable,ProdPoolId)).value(queryNotValue(BOT_ProdPoolID::Delete ));

 

 

 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mea_ Profile Picture
    60,286 on at

    Hi SSRSGuy,

    You can try next code

    qbdsProdTable.addRange(fieldNum(ProdTable, ProdPoolId)).value(strFmt('((ProdPoolId != "%1") && (ProdPoolId != "%2"))', 
        queryValue(BOT_ProdPoolID::Hold),
        queryValue(BOT_ProdPoolID::Delete)));
    

    Please find additional details about expressions in query ranges here http://www.axaptapedia.com/Expressions_in_query_ranges

    Please note that ProdPoolId is not enum but string and usually we don't use enums to create a range by a string field.

  • Community Member Profile Picture
    on at

    Thank you so much ievgen!!!!!!!! I spent too many hours trying to figure that out. Have a great day.

  • Community Member Profile Picture
    on at

    Thank you Crispin!!!!!!!!!!! Have a great day.

  • Dang Vo Profile Picture
    31 on at

    queryBuildRange.value(strFmt('%1,%2',
    queryValue(queryNotValue(BOT_ProdPoolID::Hold )),
    queryValue(queryNotValue(BOT_ProdPoolID::Delete)));

  • Deo Profile Picture
    10 on at

    THanks, very nice

  • Suggested answer
    Mikhail Lakhvich Profile Picture
    23 on at

    I'll leave it here.

    qbdsProdTable.addRange(fieldNum(ProdTable, ProdPoolId)).value(
    queryRangeConcat(SysQuery::valueNot(BOT_ProdPoolID::Hold), SysQuery::valueNot(BOT_ProdPoolID::Delete)));


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 Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sanhthosh.Kumar.K Profile Picture

Sanhthosh.Kumar.K 2

#2
Raed Salah Bzour Profile Picture

Raed Salah Bzour 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans