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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

QueryBuildRange object not initialized

(1) ShareShare
ReportReport
Posted on by 619
Hi, I got the following message when cleaning up and adding some ranges to a formdatasource
 
 
The code where this case occurs is as follows:
 
I have observed that if I comment the line clearRanges the error disappears and performs its function, since the purpose of this code is to enter a form and add to its datasource ranges. However, I find it strange that this error occurs, because I have done this same process many times before for other forms and I have not got this error.
I have the same question (0)
  • Suggested answer
    Waed Ayyad Profile Picture
    9,212 Super User 2026 Season 1 on at
    Hi,
     
    I noticed something on your code. Why you define fds and then use queryWHSWaveTable = fds.queryBuildDataSource();
     
    You can use queryWHSWaveTable  = FormRun.add(FormDatasourceStr(WHSWaveTableListPage, WHSWaveTable);
     
    When you debug the code, did you sure t that this line  fds= FormRun.add(FormDatasourceStr(WHSWaveTableListPage, WHSWaveTable); not null?
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Layan Jwei Profile Picture
    8,280 Super User 2026 Season 1 on at
    Hi,
     
    What method are you using?
  • Jesús García Profile Picture
    619 on at
    Hello @Waed, thank you for the information you have provided. I'll tell you in parts: 
    1- I use FormDataSource to save the datasource that initially has the form and clean the ranges that it adds in a standard way and then add mine.
    2- I have tried the FormRun.add method and when I launch it, the compiler informs me that this method does not exist in the FormRun.
  • Jesús García Profile Picture
    619 on at
    Hi @Lawan, its the clicked method from a Tile Button
  • Suggested answer
    Waed Ayyad Profile Picture
    9,212 Super User 2026 Season 1 on at
    Hi,
     
    You mean you need to get the current Query on your form DataSource?
     
    You can add the following:
     
    fds                = YourDataSourceName_ds.Query().dataSourceTable(tablenum(YourTable));
    Or 
    queryWHSWaveTable  = YourDataSourceName_ds.Query().dataSourceTable(tablenum(YourTable));
    Use one variable for QueryBuildDatasource fds or queryWHSWaveTable . No need for this line queryWHSWaveTable = fds.queryBuildDataSource();

    Don't forget to continue the code based on the chosen variable.  
     
    Also see the following link:
     

     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Jesús García Profile Picture
    619 on at
    Hi @Waed, I understand what you are showing me but my case is peculiar, let me explain:
    I have a form with a certain amount of Tiles Button. These tiles button show a counter from a query that I launch by doing an override of the getData method. The Tile button allows you, when you click on it, to enter the form it refers to. Then, so that, when you enter the form, it filters the same as in the previously mentioned query, I make an override of the clicked method and call the form from the code (that's why I have the code shown above). And as I said, I have replicated this code in other Tiles button and it has not given me any kind of problem, it has worked correctly, but in this case it has not.
  • Verified answer
    Waed Ayyad Profile Picture
    9,212 Super User 2026 Season 1 on at
    Hi,
     
    1-I got your point, but I think you can do it in another way you can clear the ranges on the init of the form that will open when you click on the tile.
    if(element.args()&& element.args().menuItemName() == menuitemdisplaystr(YoueMenuItemName))
    {
       YourDataSource_ds.queryBuildDataSource() 
    }
     
     
    2- Try to change copy caller query property to No on the Display Menu Item, but you should make sure the menu item is only used only on this place.
     
    Thanks,
    Waed Ayyad
     
    If this helped, please mark it as "Verified" for others facing the same issue
     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 393 Super User 2026 Season 1

#2
Subra Profile Picture

Subra 385

#3
Martin Dráb Profile Picture

Martin Dráb 252 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans