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)

Query range not getting value

(0) ShareShare
ReportReport
Posted on by 165

Hello,

I have added a range VendorAccount to my table to filter the records using VendorAccount.

But even after selecting criteria value in query dialog, it doesn't capture the vendor account passed. What am I missing to set the value to the criteria chosen? 

I have put the code in a initQuery() method in my class.

0486.12.JPG

1805.13.JPG

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Hi mrpequit!

    Try the following:

    1. In ClassDeclaration declare QueryRun variable

    QueryRun    queryRun;


    2. Override initParmDefault() method and call initQuery() method

    public void initParmDefault()
    {
        this.initQuery();
    
        super();
    }

    3. In initQuery() method set value to queryRun variable which was declared in classDeclaration:

    queryRun = new QueryRun(query);



    4. Override queryRun() method and return your queryRun variable:

    queryRun queryRun()
    {
        return queryRun;
    }



  • mrpequit Profile Picture
    165 on at

    Hello Rustem, I already did your suggestion but it still fails to set the value of the criteria entered by the user in the dialog form.

  • Rustem Galiamov Profile Picture
    8,072 on at

    Can you provide some screenshots of your class?

  • mrpequit Profile Picture
    165 on at

    hi,

    class declaration:

    queryrun.JPG

    initParmDefault

    initparm.JPG

    initQuery (where I added additional range)

    540765.2.JPG

    queryRun()

    queryrun.JPG

    is there something I miss? I've tried hard coding the value for vendor and it works so I assume that there is a missing method to capture the criteria input of the user and set it as the value for range

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    In my case the queryRun() method looks like 

    queryRun queryRun()
    {
        return queryRun;
    }


    without public, but and with public it works...

    Screenshot-2018_2D00_09_2D00_28-at-11.53.46-AM.png

    Screenshot-2018_2D00_09_2D00_28-at-11.52.46-AM.png

    Screenshot-2018_2D00_09_2D00_28-at-11.52.37-AM.png

    Screenshot-2018_2D00_09_2D00_28-at-11.53.03-AM.png

    Screenshot-2018_2D00_09_2D00_28-at-11.53.09-AM.png

    Screenshot-2018_2D00_09_2D00_28-at-11.53.23-AM.png

    Screenshot-2018_2D00_09_2D00_28-at-11.53.33-AM.png

    Screenshot-2018_2D00_09_2D00_28-at-11.53.40-AM.png

    Screenshot-2018_2D00_09_2D00_28-at-11.53.46-AM.png

  • mrpequit Profile Picture
    165 on at

    hello,

    I tried removing public but it still doesn't work. I also did an incremental CIL

  • mrpequit Profile Picture
    165 on at

    Hello,

    I noticed that in my unpack method, initQuery() is being called, and causes to re-init the values of the ranges. But if I remove the calling of initQuery() in unpack method, the ranges are removed from the dialog.

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Did you override showQueryValues() method?

    3833.Screenshot-2018_2D00_09_2D00_28-at-11.53.33-AM.png

  • mrpequit Profile Picture
    165 on at

    yes, showQueryValues() is already override

  • Rustem Galiamov Profile Picture
    8,072 on at

    and return true?

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
CP04-islander Profile Picture

CP04-islander 26

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans