cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AndKanPA
Resolver I
Resolver I

Confusion FetchXML

Hello community,

 

I have 3 tables.
Table 1 computers:
- Name (string)
- companyid (lookup 1:n table2)

- employeeid (lookup 1:n table3)

 

Table 2 companies: 

- Name (string)

 

Table 3 employees:

- Name (string)

Query:

 

<fetch top="50" >
  <entity name="table1" >
    <all-attributes/>
    <filter>
      <condition attribute="cr847_p_auftragid" operator="eq" value="68d81326-f939-eb11-a813-0022480691de" />
    </filter>
    <link-entity name="cr847_company" from="cr847_companyid" to="cr847_company" />
    <link-entity name="cr847_employe" from="cr847_employeid" to="cr847_employe" />
  </entity>
</fetch>

 

When employe or company is not set, I didnt get null results.

 

Is there an option to get results, when employe or company not set?

 

Thanks,

AndKan.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisPiasecki
Super User
Super User

Hi @AndKanPA,

 

If I understand your question correctly, you are asking whether you can return records from Table 1 (Computers) even when the Employee or Company Lookup is null?

You can add the link-type="outer" attribute to the Employee and Company link-entity elements. This is the equivalent of a left outer join in SQL. 

 

Reference with examples at the link below.

https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/use-fetchxml-left-outer-joi...

 

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

View solution in original post

1 REPLY 1
ChrisPiasecki
Super User
Super User

Hi @AndKanPA,

 

If I understand your question correctly, you are asking whether you can return records from Table 1 (Computers) even when the Employee or Company Lookup is null?

You can add the link-type="outer" attribute to the Employee and Company link-entity elements. This is the equivalent of a left outer join in SQL. 

 

Reference with examples at the link below.

https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/use-fetchxml-left-outer-joi...

 

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,883)