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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

X++ Query

(0) ShareShare
ReportReport
Posted on by 125

Hi experts , i have the following select statement and need to write x++ query with the same  result ,

my problem is i don't know how to make combination of OR ranges.

my select statement is :

CustTrans custTrans;


while select custTrans
order by custTrans.FlxContractId,custTrans.DueDate

where
(custTrans.FlxLeaseTypeId == "Rent" && custTrans.DueDate == dateStartMth(SysQueryRangeUtil::currentDate()))
||
(custTrans.FlxLeaseTypeId == "Elect. Settlement" && custTrans.DueDate < dateStartMth(SysQueryRangeUtil::currentDate()))

&& custTrans.KREC_Blocked== false
&& custTrans.Printed == false
&& custTrans.SettleAmountCur == 0

*This post is locked for comments

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

    Hi Maged Kassem,

    You can use expressions in query ranges, please refer for details www.axaptapedia.com/Expressions_in_query_ranges

  • Maged Kassem Profile Picture
    125 on at

    Hi ievgen,

    my problem is i want to change the value of the range (due date) when the range (custTrans.FlxLeaseTypeId) changed. can you explain more.

  • Verified answer
    Heinz Schweda Profile Picture
    1,367 on at

    Hello,

    the tip from ievgen is all what you need.

    Anyway, the following should fullfill your requirement

       query = new query();

       qbds = query.addDataSource(tableNum(CustTrans));

       sysQuery::findOrCreateRange(qbds, fieldNum(CustTrans, recId)).value(

           strfmt('((%1 == "%2") && (%4 == %5)) || (%1 == "%3") && (%4 < %5))',

                           fieldstr(CustTrans, FlxLeaseTypeId),

                           "Rent",

                           "Elect. Settlement",

                           fieldstr(CustTrans, DueDate),

                           Date2StrXpp(dateStartMth(SysQueryRangeUtil::currentDate()))

                           ));

    The three additional fields can be added as usual.

    Regards,

    Heinz

  • Maged Kassem Profile Picture
    125 on at

    Thank you very much Heinz for your support , much appreciation.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
Basit Profile Picture

Basit 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans