Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

How to find dimension query value in X++

(1) ShareShare
ReportReport
Posted on by 159
Hi Team,
 
I am working in SSRS report.
 
Here in report dialog i have to add filter on Main account, to achieve this i have wrote the below code in controller class prePromptModifyContract().
 
protected void prePromptModifyContract()
{
 QueryBuildDataSource qbdGeneralJournalAccountEntry;
  Query                query;

   query = this.parmReportContract().parmQueryContracts().lookup(this.getFirstQueryContractKey());

 qbdGeneralJournalAccountEntry = SysQuery::findOrCreateDataSource(query, tableNum(GeneralJournalAccountEntry));
        
        SysQuery::addDimensionAttributeFilter(query,
                                                qbdGeneralJournalAccountEntry.name(),
                                                fieldStr(GeneralJournalAccountEntry, LedgerDimension),
                                                DimensionComponent::DimensionAttribute,
                                                SysQuery::valueEmptyString(),
                                                DimensionAttribute::getWellKnownDimensionAttributeName(DimensionAttributeType::MainAccount));
}
Now i have to get selected Main account value from dialog box in controller class validate method.
Below is the code.
 
protected boolean validate()
    {
        boolean        isValid = true;
        Query          query;
        QueryBuildRange                    queryBuildRange;
        QueryBuildDataSource               queryBuildDataSource;

        query    = this.getFirstQuery();

        queryBuildDataSource = query.dataSourceTable(tableNum(GeneralJournalAccountEntry));
        queryBuildRange      = queryBuildDataSource.findRange(fieldNum(GeneralJournalAccountEntry, LedgerDimension));
        
       return isValid;
}
 
In above code queryBuildRange i am not able to get main account value.
 
Please let me know how to achieve this.
 
Categories:
  • Martin Dráb Profile Picture
    Martin Dráb 230,333 Most Valuable Professional on at
    How to find dimension query value in X++
    Please explain what exactly you mean by "not able to get" and why you want it all. Your requirement was adding a filter, not to extract the filter from the query. If you mean that no filter was applied to the query, that's a different question and should look at the code that should have added it.
     
    If you haven't already done it, look at what query your code generated. You might immediately see a problem there.

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

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,331 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,333 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans