Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / how to call querybuild...
Finance forum
Suggested answer

how to call querybuildrange varaiable in a formdatasource extension

Posted on by 69
Hi,
 
A querybuildrange variable is declared in form Class Declaration, initialized in FormDataSource\init method and assigned value in FormDatasource\linkActive method.
 
I am extending linkactive method as I have to assign some other value to querybuildrange variable.
 
How to call querybuildrange variable in Formdatasource extension class.
 
Lakshmi
Categories:
  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,582 Super User 2024 Season 1 on at
    how to call querybuildrange varaiable in a formdatasource extension
    You would require getter setter methods. Can you give us the complete requirement?
  • Suggested answer
    Moussy Profile Picture
    Moussy 17 on at
    how to call querybuildrange varaiable in a formdatasource extension
    Hi,
     
    If you need to also clear previous ranges that are set, on top of what @Waed Ayyad wrote, you can do:
      QueryBuildDataSource qbds = this.query().dataSourceTable(tableNum(TheTableName));
      qbds.clearRanges();
     
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 5,893 Super User 2024 Season 2 on at
    how to call querybuildrange varaiable in a formdatasource extension
    Hi,
     
    You can't access Form variables through the extension classes of the form. If you have getter method in the standard form that return the variable you can call it otherwise you can't.  I think you can define new range for the same DataSource and add the range values that you want.

     For example, you can add like the following code:
    
    QueryBuildDataSource queryBuildDataSource = this.query().dataSourceTable(tableNum(TheTableName));
    QueryBuildRange qbr = QueryBuildDataSource.addRange(FieldNum(TableName,fieldName).value('');
    
    


    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 7,165 Super User 2024 Season 2 on at
    how to call querybuildrange varaiable in a formdatasource extension
    Hi,
     
    If it's declared in class declaration, then you can access it using "element" keyword
    element.VariableName
     
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future

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

News and Announcements

Give Back to the Community this Month

Quick Links

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,807 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,135 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans