Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

Creating and merging DataSet/EntityRecord

(1) ShareShare
ReportReport
Posted on by

Hi community,

 

just wanted to ask if there's a possibility to either create a DataSet or merge, respectively push, new records?

 

Use case:

I want to display the dataset and additional records from a webapi response. To do this I would have to merge the templates into the custom entity dataset but don't really know how as I cannot create a DataSet from scratch nor push new items.

 

I'm using react and input components to render lookups, datetime fields etc. and they're using the dataset properties. Is there a possibility to add new items to an existing DataSet? Or how would you approach this problem?

 

let items: ComponentFramework.PropertyHelper.DataSetApi.EntityRecord[] = this.props.checklist.sortedRecordIds.map(rec => this.props.checklist.records[rec]);

Because of EntityRecord[] functions I'm unable to push new EntityRecords too.

 

Thanks in advance!

  • Community Power Platform Member Profile Picture
    on at
    Re: Creating and merging DataSet/EntityRecord

    I ended up writing a wrapper class for the WebApi.EntityRecord interface and a module that creates a List of EntityLocalRecords (wrapper class) which contains the dataset records and the web api results.

  • Community Power Platform Member Profile Picture
    on at
    Re: Creating and merging DataSet/EntityRecord

    @DianaBirkelbach 

    Thanks for your feedback. I'm sorry I wasn't really specific about the use case.

     

    In short the pcf needs to display these record sets as an aggregate

    - dataset of checklists (bound custom entity)

    - RetrieveMultipleResponse of template checklists (retrieved template checklist)

     

    As soon the template checklists were retrieved I need to merge these two record sets into one.

     

    @cchannon 

    Thanks too.

    The dataset grid is actually a DetailsList. I'll go with your second suggestion and tweak it to avoid having to rewrite the crm input react components. These components use the dataset, column etc. interfaces.

     

     

    I'll be happy to share my solution and welcome any further ideas.

     

     

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: Creating and merging DataSet/EntityRecord

    There are a couple effective answers to this.

     

    1. A Virtual Entity. Virtual Entities allow you to create a table that doesn't ever store data. It is simply used to allow you to attach custom plugin code to the various table events (Retrieve, RetrieveMultiple, eg.) so that you can simulate a table where it doesn't really exist. Usually, this is used for integration purposes (I want to see all "orders" but orders are actually stored in a different database; we use a virtual entity to make it look like they are stored in Dataverse). But it can also be used for cases where you need to simulate the fusion of two tables (kind of like you're making your own ActivityPointer).
    2. Within your PCF, yes, you can absolutely merge those records, although you're right that the EntityRecord[] is a bit of a nuisance. To merge these sets, think about how your presentation layer is going to operate, then work backward from that. I would recommend using a Fluent UI Details List because it immediately replicates most of the functionality of a Dataverse grid and it matches the look and feel of the UI overall. If you go that way, then the DetailsList takes into props a simple Array<any> as the rows. That means that in your index, you will simply loop over all your EntityRecords from both sets and push each one to a new [] that will be your combined rows. The DetailsList then can readily consume that array without needing to worry about the complexities of how EntityRecord[] is structured.
  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at
    Re: Creating and merging DataSet/EntityRecord

    Hi @Anonymous , 

     

    The dataset is read-only. To make update/merge to your dataset-data you need to implement the webAPI requests by yourself. That's possible for now only in model-driven PCFs. You can refresh the dataset afterwards using dataset.refresh(). This will trigger an updateView again, where the dataset is containing the new data.

     

    It depends what kind of additional records to the dataset you need, but sometimes is good to consider that you can have two or more datasets in the PCF (all datasets are read-only).

     

    Hope this helps!

     

    Kind regards,

    Diana

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 109 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 72

Overall leaderboard