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

create query range for Date value

(0) ShareShare
ReportReport
Posted on by

Hi

I want to add a range to a query by code.

It is a range on a date field (ToDate) on the PriceDiscTable.

The query value should be less or equal the given date (from a dialog, which I already stored in a local variable)

How can I do this. Adding a range to the FromDate with greater or equal worked fine but the less or equal is not good.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Agha SirajulDola Profile Picture
    555 on at

    Hey there,

    try following

    query.dataSourceTable(tableNum(PriceDiscTable)).

                  addRange(fieldnum(PriceDiscTable,ToDate)).value(queryRange(1/1/1990, FromDate));

    Regards,

    Agha

  • Mariano Gracia Profile Picture
    on at

    Use SysQuery class, it has a lot of functions for query values

        QueryBuildDataSource    qbdsPriceDiscTable;
        QueryBuildRange         qbrDate;
        TransDate               toDate;
        
        qbrDate = SysQuery::findOrCreateRange(qbdsPriceDiscTable, fieldNum(PriceDiscTable, ToDate));
        qbrDate.value(SysQuery::range(dateNull(), ToDate)); 


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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Liquid error: parsing "/globalsearch/?q=%D7%9B%D7%9E%D7%94+%D7%9E%D7%A1+%D7%9E%D7%A9%D7%9C%D7%9E%D7%99%D7%9D++89+%D7%93%D7%95%D7%9C%D7%A8" - Nested quantifier +.