Notifications
Announcements
No record found.
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.
Hi Ashokkumar,
Please try this:
while select test where test.name =='ashok' || test.name =='karthik'.
Hope this helps.
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));
}
'in' operator is supported in F&O (with slightly different syntax), but it doesn't exist in older versions of AX.
Hi Hariharan S,
Thanks for your response but each time give buffer.field, has it any alternative?
Hi Will WU
No. That is X++ syntax.
Can you explain your business scenario, please?
Hi Martin,
Thanks for your response it's just for know, In case in my future , i will use it.
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".
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 559 Most Valuable Professional
André Arnaud de Cal... 464 Super User 2025 Season 2
Sohaib Cheema 250 User Group Leader