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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Dataverse List Rows Ac...
Power Automate
Unanswered

Dataverse List Rows Action - What is the easiest way to combine data from two Dataverse tables into a CSV file.

(0) ShareShare
ReportReport
Posted on by 126

Hello,

 

I have two Dataverse tables. Let's call one Company and one Company_Users.

 

I want to utilize a Lists rows action to create a CSV file. I want to add several columns from each table and show the related lookup columns accordingly.

I thought the expand query feature would be my saving grace but I don't think I am utilizing it correctly. 

 

Any suggestions would be great!

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @dcastillo1 

     

    You could check my below response that talks about the method of using expand query:

    Re: List rows that match a GUiD - Power Platform Community (microsoft.com)

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • dcastillo1 Profile Picture
    126 on at

    Thanks for the response but I could use some more information. I was able to find the query for my related table but how can I incorporate the data into my CSV action? 

    dcastillo1_0-1711516583177.png

     

    The end of the output looks something like this: 

     

    "lg_MM_Company_Users_Company_Lookup_lg_Com@odata.type": "#Collection(Microsoft.Dynamics.CRM.lg_mm_company_users)",
    "lg_MM_Company_Users_Company_Lookup_lg_Com": [
    {
    "@odata.type": "#Microsoft.Dynamics.CRM.lg_mm_company_users",
    "@odata.id": "https://org6c3cdacb.crm.dynamics.com/api/data/v9.1/lg_mm_company_userses(dc370e28-5dcb-ee11-9079-000d3a1a0098)",
    "@odata.etag": "W/\"11940728\"",
    "@odata.editLink": "lg_mm_company_userses(dc370e28-5dcb-ee11-9079-000d3a1a0098)",
    "lg_employeename": "John Doe",

     

    I need the string from "lg_employeename." 

     

    Everytime I add this expression:
    item()?['lg_employeename'] into the CSV table action I receive no output.

  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @dcastillo1 

     

    Pls try the below expression:

    join(xpath(xml(json(concat('{"root":',item()?['lg_MM_Company_Users_Company_Lookup_lg_Com'],'}'))),'//lg_employeename/text()'),', ')

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • dcastillo1 Profile Picture
    126 on at

    This is the error I'm receiving. 

     

    The execution of template action 'Create_HTML_table' failed. The column values could not be evaluated: 'The template language function 'xml' parameter is not valid. The provided value cannot be converted to XML: 'This document already has a 'DocumentElement' node.'. Please see https://aka.ms/logicexpressions#xml for usage details.'.

     

    I placed that expression in my Create CSV table action. 

     

    dcastillo1_1-1711554816344.png

     

     

  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @dcastillo1 

     

    Pls share the sample data for whole 'lg_MM_Company_Users_Company_Lookup_lg_Com' array.

     

     

  • dcastillo1 Profile Picture
    126 on at

    So, this is an example from the outputs of my list rows action with the expanded query:

     

    dcastillo1_0-1711558608272.png

    "lg_lg_mm_company_application_Company_Lookup_@odata.navigationLink": "https://org6c3cdacb.crm.dynamics.com/api/data/v9.1/lg_companies(c7346c54-9ed0-ec11-a7b5-000d3a9db1b8)/lg_lg_mm_company_application_Company_Lookup_",
    "transactioncurrencyid@odata.associationLink": "https://org6c3cdacb.crm.dynamics.com/api/data/v9.1/lg_companies(c7346c54-9ed0-ec11-a7b5-000d3a9db1b8)/transactioncurrencyid/$ref",
    "transactioncurrencyid@odata.navigationLink": "https://org6c3cdacb.crm.dynamics.com/api/data/v9.1/lg_companies(c7346c54-9ed0-ec11-a7b5-000d3a9db1b8)/transactioncurrencyid",
    "lg_MM_Company_Users_Company_Lookup_lg_Com@odata.associationLink": "https://org6c3cdacb.crm.dynamics.com/api/data/v9.1/lg_companies(c7346c54-9ed0-ec11-a7b5-000d3a9db1b8)/lg_MM_Company_Users_Company_Lookup_lg_Com/$ref",
    "lg_MM_Company_Users_Company_Lookup_lg_Com@odata.navigationLink": "https://org6c3cdacb.crm.dynamics.com/api/data/v9.1/lg_companies(c7346c54-9ed0-ec11-a7b5-000d3a9db1b8)/lg_MM_Company_Users_Company_Lookup_lg_Com",
    "lg_MM_Company_Users_Company_Lookup_lg_Com@odata.type": "#Collection(Microsoft.Dynamics.CRM.lg_mm_company_users)",
    "lg_MM_Company_Users_Company_Lookup_lg_Com": [
    {
    "@odata.type": "#Microsoft.Dynamics.CRM.lg_mm_company_users",
    "@odata.id": "https://org6c3cdacb.crm.dynamics.com/api/data/v9.1/lg_mm_company_userses(dc370e28-5dcb-ee11-9079-000d3a1a0098)",
    "@odata.etag": "W/\"11940728\"",
    "@odata.editLink": "lg_mm_company_userses(dc370e28-5dcb-ee11-9079-000d3a1a0098)",
    "lg_employeename": "John Doe",
    "_lg_company_lookup_value@OData.Community.Display.V1.FormattedValue": "LG-1101",
    "_lg_company_lookup_value@Microsoft.Dynamics.CRM.associatednavigationproperty": "lg_Company_Lookup",
    "_lg_company_lookup_value@Microsoft.Dynamics.CRM.lookuplogicalname": "lg_company",
    "_lg_company_lookup_value@odata.type": "#Guid",
    "_lg_company_lookup_value": "c7346c54-9ed0-ec11-a7b5-000d3a9db1b8",
    "lg_mm_company_usersid@odata.type": "#Guid",
    "lg_mm_company_usersid": "dc370e28-5dcb-ee11-9079-000d3a1a0098",
    "lg_Company_Lookup@odata.associationLink": "https://org6c3cdacb.crm.dynamics.com/api/data/v9.1/lg_mm_company_userses(dc370e28-5dcb-ee11-9079-000d3a1a0098)/lg_Company_Lookup/$ref",
    "lg_Company_Lookup@odata.navigationLink": "https://org6c3cdacb.crm.dynamics.com/api/data/v9.1/lg_mm_company_userses(dc370e28-5dcb-ee11-9079-000d3a1a0098)/lg_Company_Lookup"
    }

     

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard