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)

Change behavior of AOT Query(SysQueryForm)

(0) ShareShare
ReportReport
Posted on by 4,624

Hello,

 I have one table having two fields and one Index. Then I created a AOT query by taking this table as datasource.  Now when I open this query then  query automatically add index field as Range .But I don't want this field as range.

Query looks like below:

36425.Capture.PNG

please suggest.

*This post is locked for comments

I have the same question (0)
  • Rohin Profile Picture
    4,624 on at
    RE: Change behavior of AOT Query(SysQueryForm)

    Thanks Crispin, But we need to remove that range from query not hide.

    please suggest

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Change behavior of AOT Query(SysQueryForm)

    Hi,

    This is the standard behaviour; if you are really sure to hide the ranges, you could add one new "fake" range to the Table 3 (datasource) with these settings:

    • Field: Field2 (or one other field that is part of the index you want to hide)
    • Value: do not insert any value in this property
    • Status: Hide
  • Community Member Profile Picture
    on at
    RE: Change behavior of AOT Query(SysQueryForm)

    If you want this behavoiur for all the queries, in the form  SysQueryForm, method queryLoad, comment the call to sysQueryForm.buildQueryFilter and it should working.

    Best regards,
    Stefano.

  • Rohin Profile Picture
    4,624 on at
    RE: Change behavior of AOT Query(SysQueryForm)

    Thanks Crispin & Fibbi.

     We don't want the code to be generic , it will impact on all running queries. We want this for specific query merely so how to do that please suggest.

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at
    RE: Change behavior of AOT Query(SysQueryForm)

    Hi,

    Override the init method of the query and use following code to remove the default range created from primary index. Replace SampleTable with your Table and Field1 with your required field. Actually we are not removing but hiding the range.

    public void init()
    {
        QueryBuildDataSource qbds;
        QueryBuildRange qbr;
        
        super();
    
        qbds = this.query().dataSourceTable(tableNum(Sampletable));
        
        qbr = SysQuery::findOrCreateRange(qbds, fieldNum(SampleTable, Field1));
        qbr.status(RangeStatus::Hidden);
    }
  • Rohin Profile Picture
    4,624 on at
    RE: Change behavior of AOT Query(SysQueryForm)

    I totally agree Chaitanya but it would do the same thing , It only hide the range on form but still range would be there . I just want to remove the range (remove the filter on form due to this range).

    Please suggest how to remove this range.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Change behavior of AOT Query(SysQueryForm)

    Hi Visvash,

    Check the following link whether you able to solve the issue,

    http://www.kishorjadhav.com/2011/11/how-to-show-or-hide-query-ranges-on.html

    Thanks,

    Rahul R

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Change behavior of AOT Query(SysQueryForm)

    Hi Visvash,

    try this,

    public boolean showIndexFields(tableId _tableId)

          boolean ret = true; 
      
          switch (_tableId)
         { 
             case tableNum(YourTable): 
                     ret = false; 
             break; 
         } 

         return ret; 
    }

    Thanks,

    Rahul R

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
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans