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 :
Finance | Project Operations, Human Resources, ...
Answered

any words are there to replace 'IN' keyword in sql to x++

(0) ShareShare
ReportReport
Posted on by

Hi,

while select test where test.name in ('ashok','karthik')
    { 
        info(strFmt("%1 - %2",test.name,test.age));
    }

how to use 'in' keyword in x or how to give condition in where like above mentioned.

I have the same question (0)
  • WillWU Profile Picture
    22,361 on at

    Hi Ashokkumar,

    Please try this:

    while select test where test.name =='ashok'  || test.name =='karthik'.

    Hope this helps.

  • Suggested answer
    Hariharans87 Profile Picture
    3 on at

    In X++ there is no "IN" logical operator. You can use || (or) operator.

    Available relational operators

    docs.microsoft.com/.../relational-operators

    while select test

           where (test.name == 'ashok' ||

                   test.name == 'karthik')

       {

           info(strFmt("%1 - %2",test.name,test.age));

       }

  • Suggested answer
    Martin Dráb Profile Picture
    237,948 Most Valuable Professional on at

    'in' operator is supported in F&O (with slightly different syntax), but it doesn't exist in older versions of AX.

  • Community Member Profile Picture
    on at

    Hi Hariharan S,

    Thanks for your response but each time give buffer.field, has it any alternative?

  • Community Member Profile Picture
    on at

    Hi Will WU

    Thanks for your response but each time give buffer.field, has it any alternative?

  • Hariharans87 Profile Picture
    3 on at

    No. That is X++ syntax.

  • Martin Dráb Profile Picture
    237,948 Most Valuable Professional on at

    Can you explain your business scenario, please?

  • Community Member Profile Picture
    on at

    Hi Martin,

    Thanks for your response it's just for know, In case in my future , i will use it.

  • Suggested answer
    Martin Dráb Profile Picture
    237,948 Most Valuable Professional on at

    The solution still depends on what you want to achieve - there is no universal answer for all possible situations.

    Most likely you should use Query* classes, although there is an option to use field IDs in select statements (you can obtain an ID as runtime), e.g. buffer.(fieldId) == "value".

  • Community Member Profile Picture
    on at

    while select test where test.name in ('ashok','karthik','yogi','martin','kumar',....)

    i want to achieve is for example a table has a 50 records it has name field but i want only particularly 20 records only it depends on name, that 20 names i will  above mentioned like that.

    any possible is there 

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 559 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 464 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans