Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Microsoft Dataverse
Suggested answer

Subgrid - How to import data to a sub-grid in Model Driven App

(0) ShareShare
ReportReport
Posted on by 135
How to import multiple rows of data to a sub-grid in Model Driven App and still keep the relationship after import?
 
Allow me to expand, i have two tables that i would like to move to dataverse, Invoices (header) and Invoice_lines (child). They are linked via invoice_id field. I want to create a model driven app where a sub-grid (Editable), wherein I can edit the ones that already exist, and/or add new lines and add them to the Invoice_lines table while it maintains a relationship. 
 
Categories:
  • Suggested answer
    Fubar Profile Picture
    7,821 Super User 2025 Season 1 on at
    Subgrid - How to import data to a sub-grid in Model Driven App
    In Dataverse you would avoid linking the way you have. Pretty much everything links via GUIDs.
     
    Your Invoice record in Dataverese will have a unique identifier (a GUID) automatically assigned to it when it is created (in a field with the same logical schema name as the Table but with an "id" suffix. You may consider putting your existing Invoice_id into the Primary Name column (this column is what users see in the Lookup field on child records, but behind the scenes the linkage is actually the parent records GUID), then using an autonumber on the Primary Name column to continue the sequence.
     
    In Dataverse for your line item Table add a Column of Type Lookup (to Invoice) - this will be your replacement one-to-many relationship.
     
    With that structure adding new records into the subgrid etc will automatically be linked via the Lookup column.
     
    Your issue with importing pre-existing data is to get the Lookup field to map to the correct Invoice record. By default the out of the box mapping for the Lookup on the Child record will usually look for the GUID or Primary Name of the parent record, this mapping can be changed during import so the Lookup on the Child record looks for a different field with a unique value.
    • During Import, set the import so that your Line Item field with the invoice_id is mapped to the Lookup field in Dataverse. (if not using the Primary Name of the Parent record to hold the existing invoice_id, alter the mapping during import to use a different field.
    • Alternatively, after importing the Invoices, export them (this will include the GUID in a hidden column A) and then populate your Line Items with the GUID, and use the field with the parent GUID map to the Invoice.
     
  • Suggested answer
    stampcoin Profile Picture
    275 on at
    Subgrid - How to import data to a sub-grid in Model Driven App
    I suggest two options:
    • Import the table via power app make portal -> Table ->Import data (top command area). if you didn't define the tables.
      then create the relations between the two tables , Parental relationship behavior.
      then build the form and subgrid.
    • Create the table manually, define the relationship. publish it. Then use data management to import the data.
    check the attached image
     
     
  • ctrl_kudorje Profile Picture
    135 on at
    Subgrid - How to import data to a sub-grid in Model Driven App
    Allow me to expand, i have two tables that i would like to move to dataverse, Invoices (header) and Invoice_lines (child). They are linked via invoice_id field. I want to create a model driven app where a sub-grid (Editable), wherein I can edit the ones that already exist, and/or add new lines and add them to the Invoice_lines table while it maintains a relationship. 
     
  • Suggested answer
    Fubar Profile Picture
    7,821 Super User 2025 Season 1 on at
    Subgrid - How to import data to a sub-grid in Model Driven App
    You may need to be more clear - a subgrid is just a control that shows records linked to the current record by either a one-to-many or a many-to-many relationship (but you can configure it to show all data in a table also).
     
    How you may import data is different for a one-to-many vs a many-to-many. For a one-to-many your import file must include a column that either has the GUID of the parent record or some other unique identifier on the parent record. You then use standard data import to import the records, you may need to update the Mappings depending on where your data is coming from. 
     
    many-to-many is more complicated, so will hold off describing it unless it is confirmed that is what you need
  • Michael E. Gernaey Profile Picture
    40,252 Super User 2025 Season 1 on at
    Subgrid - How to import data to a sub-grid in Model Driven App
     
    the question is not clear as you don’t import data into a grid. You import data into a table and if an Entity has relationships and if you add a grid, it will show them. 
     
    Can you please explain the data you are importing and the relationship it has with existing data. 
     
    or are you importing data for the parent and the child?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,522 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,869 Most Valuable Professional

Leaderboard

Featured topics