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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Generating a preview from SysQueryForm

(0) ShareShare
ReportReport
Posted on by

Hi all

I have an interesting thought from an end-user: it would be handy to have a "preview" run of any query that's currently made up in the SysQueryForm.

Is this even possible? Building a grid dynamically based on a passed query and execute it with like the first 10 rows.

Conceptually, i guess yes, as you know the tables, fields and ranges. You could then create proper columns and then execute the query and populate the grid.

The difficult part lies in converting the in-memory (not in AOT!!) Query and its QueryBuildDataSources to FormBuildDatasources etc. Is there an easy way? Preferably, I dont want to loop over all the datasources/ranges and convert. Simply passing along the query (or its datasources) as an object somewhere would be perfect.

Interested to hear your opinions.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mea_ Profile Picture
    60,284 on at
    RE: Generating a preview from SysQueryForm

    Hi Tim De Lobelle,

    Its already done a while ago www.axaptapedia.com/DEV_QueryBrowser

  • Community Member Profile Picture
    on at
    RE: Generating a preview from SysQueryForm

    exactly what i needed, much thanks!

  • Community Member Profile Picture
    on at
    RE: Generating a preview from SysQueryForm

    For anyone interested in the solution, see screenshots.

    1. First import the project mentioned above. I decided not to import the context menu stuff.
    2. Then add a button on the SysQueryForm (see screenshot 1)
    3. Add the code in the clicked method (see screenshot 1)
    4. Click the button and the current query you are editing in the SysQueryForm should display results in the QueryBrowser.
    5. Have fun :-)

    sysquery3.png

    sysquery3.png

  • Community Member Profile Picture
    on at
    RE: Generating a preview from SysQueryForm

    @TimDeLobelle

    I wanted to ask how you implemented this. Can you explain.

  • Community Member Profile Picture
    on at
    RE: Generating a preview from SysQueryForm

    Hi Maha

    The steps are described in my last post.

    One thing i'd note is that you better instantiate a new query instead of passing it by reference.

    The QueryBrowser seems to fiddle with the query object and you dont want it to be changed by the querybrowser as it might result in bugs in your business logic.

    In the clicked method you should use: new DEV_QueryBrowser().run(new Query(sysQueryForm.query())); 

    What part are you having trouble with?

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
AlissonGodoy Profile Picture

AlissonGodoy 2

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans