Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to apply query Range on Dimension 2

(0) ShareShare
ReportReport
Posted on by 285

HI,

I want to apply query range on dimension 2. All possible ways work with dimension[1] but it did not work with dimension[2].

I want to pass dynamic string to dimRange.Value. which will contain two columns on which i will set range. So, while declaring dimRange i declared it for any other column and i mension columnName==[Value] in 'QueryRange.Value'. But for dimension[2] it fails.

I also refered this link: http://www.axaptapedia.com/Talk:Expressions_in_query_ranges

bellow code i am trying out:

 dimRange = EmplTable_ds.query().dataSourceTable(tablenum(EmplTable)).addRange(fieldnum(EmplTable, CurrentFacility));

 dimRange.value(strFmt('(%1=="%2")',fieldId2Ext(fieldNum(EmplTable, Dimension),2), "PSDU4"));

*This post is locked for comments

  • Suggested answer
    abhijeet patil Profile Picture
    285 on at
    Re: How to apply query Range on Dimension 2

    I got the answer......

    for applying range on two columns out of which one is dimension2

    e.g. dimRange.Value(CurrentFacility=='xyz' || dimension2=='PSDU4');

    here is the answer:

    str range;

    ;

    dimRange = EmplTable_ds.query().dataSourceTable(tablenum(EmplTable)).addRange(fieldnum(EmplTable, CurrentFacility)); // mention any column

    range = strfmt (

                                '( (%1 ==%2) || (%3.%4==%5))'

                                ,'CurrentFacility'  

                                , 'XYZ'

                                , EmplTable_ds.Name()

                                , fieldid2name(tablenum(EmplTable), fieldid2ext(fieldnum(EmplTable, Dimension), Dimensions::code2ArrayIdx(SysDimension::Center)))

                                ,'PSDU4'

                              ) ;

    dimRange.value(range);

    and it's done !!!!!!!!!!!

  • abhijeet patil Profile Picture
    285 on at
    Re: How to apply query Range on Dimension 2

    hey thanks for quick reply. Life is easy because of people like you :)

    if i want to set range on only on dimension[2] it works perfect.

    what if i want to set range as:

    dimRange.value(CurrentFacility=='XYZ' || dimension2 =='PSDU4')

  • Verified answer
    Community Member Profile Picture
    on at
    Re: How to apply query Range on Dimension 2

    Try doing this instead, should be a bit easier:

    dimRange = EmplTable_ds.query().dataSourceTable(tablenum(EmplTable)).addRange(fieldid2Ext(fieldnum(EmplTable, Dimension), 2));

    dimRange.value(SysQuery::queryValue("PSDU4"));

     

    Best regards,

    -Justin Biggs

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,000 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,850 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans