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)

multiple table query grouping

(0) ShareShare
ReportReport
Posted on by

Hello,

I have an issue. There is a query made of inventTrans and inventDim tables. I need to group by one of InventTrans and a few of InventDim fields. Query works fine, when I add invTransDS.addGroupByField(fieldnum(InventTrans, ItemId)) it groups by itemId from inventTrans, but other fields from inventDim becomes null in grouped record. How could I solve this? Thank you.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    If you use group by, only groupped and aggregated fields are going to having values.

  • Community Member Profile Picture
    on at

    How could I define groupped field that I need?

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    I am unsure what exactly do you mean, but you need to group by on all datasources on all fields that you expect to return. Here is an example:

    axatluegisdorf.blogspot.hu/.../select-group-by-and-join-order-by.html

  • Verified answer
    Zain Bokhari Profile Picture
    3,208 Moderator on at

    You can only get the grouped data from multiple fields, if you group by multiple fields.

    For example if a table has three fields A, B, C and you group by A, you will only get the value for A. The other fields, if non-numeric, will be blank.

    If you want results for all of these fields you can add all of these as group by fields on the datasource. Which will give you combinational groups of fields.

    ( A-value1 B-value1 C-value1 )

    ( A-value1 B-value1 C-value2 )

    ( A-value1 B-value2 C-value1 )

    ( A-value1 B-value2 C-value2 )

    and so on ..

    You get the idea.

    Where do you want to use this query btw? Report? Because if so, you can do the grouping at report end as well.

  • Community Member Profile Picture
    on at

    I use this query in a form. When I group by two fields, it groups well (the amount of rows is correct), but one field still doesn't have value.

  • Zain Bokhari Profile Picture
    3,208 Moderator on at

    If that field is a text field it will definitely not have a value. Like I said, non-numeric non-grouped fields are left blank when a grouping is added to the query.

  • Community Member Profile Picture
    on at

    Its non-numeric, but I group by this field and it shows no value.

  • Community Member Profile Picture
    on at

    It groups correctly, it just doesn't show the value.

  • Zain Bokhari Profile Picture
    3,208 Moderator on at

    Can you show us your query? with all groups ?

  • Community Member Profile Picture
    on at

    8270.Untitled.png

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans