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 :
Small and medium business | Business Central, N...
Answered

Query Left Join Not Working

(0) ShareShare
ReportReport
Posted on by 3,247

Hi Guys

On Query object -I'm struggling with a left join from Item table to attributes table. Some items don't have all the attributes and these items are not displayed since the DataItemTableFilter acts as a where clause. Is there anyway get all items including items without attributes.  Sample code:

                                    dataitem(ItemAttributeValueMapping; "Item Attribute Value Mapping")
                                    {
                                        DataItemLink = "No." = Item."No.";
                                        SqlJoinType = LeftOuterJoin;
                                        DataItemTableFilter = "Table ID" = const(27), "Item Attribute ID" = const(12);
Converted to SQL what I really want is something like:
Left Join No = Item.No and Table ID = 27 and Attribute ID = 12 
So all items are displayed.  I'm wondering if BC queries are advanced enough to handle this or we have develop pages with variables etc
I have the same question (0)
  • Verified answer
    AliHamza Profile Picture
    175 on at

    Hi Samantha,

    DataItemTableFilter would be used to filter the Sales Line table before joining it to the Item table. It turns out that the join is processed first, respecting the DataItemLink properties, and the DataItemFilter property is used to filter the joined results afterwards.

    This is the limitation of AL Query objects.

    Better solution is to develop pages with variables

    Verify my answer if it resolves your query

  • Verified answer
    Samantha73 Profile Picture
    3,247 on at

    Thanks for verifying this is a limitation, which is really disappointing since we cannot invest in queries unless we know for sure requirements will not end up hitting limitations and in most cases we need to expand on reports and queries as we use the system.  And I expect this will be improved in a future version without  having to create an Idea!

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,990

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,576 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,028 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans