web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

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

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    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

  • abhijeet patil Profile Picture
    285 on at

    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')

  • Suggested answer
    abhijeet patil Profile Picture
    285 on at

    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 !!!!!!!!!!!

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans