Skip to main content
Dynamics 365 Community / Forums / Finance forum / Unable to get handle o...
Finance forum
Answered

Unable to get handle on query ranges

editSubscribe (0) ShareShare
ReportReport
Posted on by 65

I am unable to get to ranges on joined datasource in a query.

(pasting below from debugger)

My query is : 

SELECT * FROM TPAPurchLineGlobalTmpCopy(TPAPurchLineGlobalTmpCopy) JOIN * FROM EcoResCategory(EcoResCategory_1) WHERE ((EcoResCategory(EcoResCategory_1).Name = N'SG&A - Professional Fees Other'))}

The problematic line is: (iDS is just a looping variable)

int maxRange = parameterQuery.dataSourceNo(iDS).rangeCount();

maxRange returns zero in this case.

Just to be sure, I tried this

QueryBuildDataSource qbds = parameterQuery.dataSourceNo(iDS);

and confirmed that the statement is accessing correct datasource. Value of qbds is SELECT * FROM EcoResCategory(EcoResCategory_1)

Any idea what I am doing wrong? maxRange should have returned value of 1 since I have a filter on Name.

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,081 on at
    RE: Unable to get handle on query ranges

    Hi,

    Do you have a source code of how the query is built?

  • HarryDesh Profile Picture
    HarryDesh 65 on at
    RE: Unable to get handle on query ranges

    I wonder why value of qbds variable is losing all ranges/filters then

    Value of qbds is SELECT * FROM EcoResCategory(EcoResCategory_1)

  • HarryDesh Profile Picture
    HarryDesh 65 on at
    RE: Unable to get handle on query ranges

    Interesting. I already fixed the problem other way but what you say can be true. However, the range on the root datasource did treat those filters as range.

  • Verified answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,081 on at
    RE: Unable to get handle on query ranges

    Hi HarryDesh,

    Are you sure it's a range, but not a filter? Try to check filterCount on the query.

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,068 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,591 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans