Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

how to filter data using excute query method

(0) ShareShare
ReportReport
Posted on by 325

final.png

i have 3 lines of data in my form form having two data sources one is pricedisctable,inventdim.
in that form customer ALMT-000001 having 2 lines and ALMT-000002 having one line if i open
a form it should show latest transaction customer wise based on fromdate means ALMT-000001 should show only line that is 7/10/2017
my quastion is in that form two data sources are there which data source i need to write excutequery method

thanks in advance....

*This post is locked for comments

  • Suggested answer
    Israel Gonzalez Profile Picture
    733 on at
    RE: how to filter data using excute query method

    Hi Karthik,

    I understand that you don't know where override the executeQuery(). I recommend you override the method in the main table datasource, for example, if you have CustTable and SalesTable and you want filter by AccountNum, the method would be in CustTable datasource and your code like this:

    public void executeQuery()

    {

       this.query().dataSourceTable(tableNum("CustTable")).addRange(fieldNum(CustTable, AccountNum)).value(AccountNumParameter);

       qbr = this.query().dataSourceTable(tableNum("CustTable")).addRange(fieldNum(CustTable, AccountNum));

       qbr.value(queryValue(AccountNumParameter));

       super();

    }

  • karthik143 Profile Picture
    325 on at
    RE: how to filter data using excute query method

    hi Mr.Chaitanya still i didnt apply ur logic once i have done ill let you know....

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at
    RE: how to filter data using excute query method

    Hi,

    Could you please try the answers suggested on your other open thread on the same issue.

    https://community.dynamics.com/ax/f/33/t/242983

    Thanks,

    Chaitanya Golla

  • karthik143 Profile Picture
    325 on at
    RE: how to filter data using excute query method

    no if i open a form it should show filtered records.

  • Suggested answer
    Ajit Profile Picture
    8,755 on at
    RE: how to filter data using excute query method

    Answer to your this question - which data source i need to write excutequery method

    You should find which data source has that date column and use that.

  • Israel Gonzalez Profile Picture
    733 on at
    RE: how to filter data using excute query method

    Hi Karthik143,

    This seems you want to filter when selecting the record, isn't it?

  • Martin Dráb Profile Picture
    232,978 Most Valuable Professional on at
    RE: how to filter data using excute query method

    This seems to be a duplicate of how can i filter latest data through x++ query. Please don't create multiple threads about the same things; continue in your original one. You've got some suggestions there and you didn't say that they don't work for you and why, so it should likely be your next step.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,217 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,978 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans