Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

missing query range

Posted on by 593

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

  • Martin Dráb Profile Picture
    Martin Dráb 230,235 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.

  • CRSW Profile Picture
    CRSW 593 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
    Martin Dráb 230,235 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
    CRSW 593 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
    Martin Dráb 230,235 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.

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

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans