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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

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

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (2,242)