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)

missing query range

(0) ShareShare
ReportReport
Posted on by 625

Hi I do have a report with a range set in controller (with setRange-Methode)

In the Dataprovider where I try to fill my temptables for report printing the range set in the controller disappeared.

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    236,751 Most Valuable Professional on at
    RE: missing query range

    Can you b a bit more specific, please?

    What did you find when you debugged your code before asking here?

    Isn't it possible that you get an older version of the query from usage data? You can verify it either by debugging or simply resetting your usage data.

  • CRSW Profile Picture
    625 on at
    RE: missing query range

    ok bit more specific.

    In the controller I set a range to a journalid. when I come to the dataprovider and try to get my query the journalId range is missing

    I reset all usage data and it is a new implemented report so no old data here

  • Martin Dráb Profile Picture
    236,751 Most Valuable Professional on at
    RE: missing query range

    Maybe your implementation in the controller is incorrect. Either debug your code or show us what you've done; we can't find bugs in in unknown implementation.

    I strongly recommend you start by debugging your code - it'll at least give you a better idea where the problem lies, which will increase your chance to solve it.

  • CRSW Profile Picture
    625 on at
    RE: missing query range
    public void setRange(Args _args, Query _query)
    {
        QueryBuildDataSource qbds;
        QueryBuildRange qbr;
        JournalId journalNum;
        LedgerJournalTrans ledgerJournalTrans;
        LedgerJournalTable ledgerJournalTable;
    
        if (_args && _args.dataset())
        {
            switch(_args.dataset())
            {
                case tablenum(LedgerJournalTrans) :
                    ledgerJournalTrans = _args.record() as LedgerJournalTrans;
                    journalNum = ledgerJournalTrans.JournalNum;
                    break;
    
                case tablenum(LedgerJournalTable) :
                    ledgerJournalTable = _args.record() as LedgerJournalTable;
                    journalNum = ledgerJournalTable.JournalNum;
                    break;
    
            }
        }
    
        
        if (journalNum != '')
        {
            qbds = _query.dataSourceTable(tablenum(GeneralJournalEntry));
    
            qbr = qbds.findRange(fieldname2id(tablenum(GeneralJournalEntry),fieldstr(GeneralJournalEntry, JournalNumber)));
    
            if (!qbr)
            {
                qbr = qbds.addRange(fieldnum(GeneralJournalEntry, JournalNumber));
            }
            qbr.value(journalNum);
        }
    
    }

    public client static void main(Args _args)
    {
        CashbookController_GLD controller = new CashbookController_GLD();
    
        controller.parmReportName(ssrsReportStr(CashbookGLD, Report));
        controller.parmArgs(_args);
        controller.setRange(_args, controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));
    
    
        if (controller.prompt())
        {
            controller.run();
        }
    }

  • Martin Dráb Profile Picture
    236,751 Most Valuable Professional on at
    RE: missing query range

    The first thing to debug is your setRange() method. Is the condition met and the range added?
    When this is verified, you can continue debugging to find out where things goes wrong.
    Also, you shouldn't call prompt() and run() directly - use startOperation() instead. Now you're skipping a lot of logic, including the call of prePromptModifyContract(), where logic like yours is often placed.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
AlissonGodoy Profile Picture

AlissonGodoy 2

#2
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans