Skip to main content

Notifications

Announcements

No record found.

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

Unable to get handle on query ranges

(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,091 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,091 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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,187 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,966 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans