Combine two models into one Table

Hello, I want to combine two different models into one table. They have similar fields and am wondering how to do this. Thanks

Hey @esr223, welcome to the Skuid community! :tada:

What exactly are you trying to do? Are your models on different objects?

While each Table can only have one model, and each model has one principal object, here are some different ways you can combine data from different objects into one model / Table.

A. Show fields from additional objects in one model

These will be read only but you can use field interactions to open a modal/sliding panel where users can edit these in a Form.

1. Related objects (parent / lookup)

You can show fields from related objects. Click into the arrow next to a lookup field to select from those fields.

Docs: Create and Configure Models > Adding Related Objects

2. Child relationships

You can also show data from child relationships (see the Child Relationships tab) in the field properties.

Tutorial: Include Child Fields in a Parent Object

3. Model lookup formula fields

Even if your objects aren’t technically related you can use a UI-Only formula to match values and return a field from any other model on your page.
Docs: Model Lookup Formula

B. Use adopt rows action to populate a new model with data from multiple source models

If you want one model that combines data from multiple other models, create a UI-Only model with the fields you want. Then use “Adopt Rows” action to adopt rows from multiple models into this one. Note: I believe this only populates field values if the field names are identical between the source and destination models. So what you could do is create fields with the same names as all the fields from both of your models, and then use template fields and merge syntax (see below) to show the appropriate field.

Again, since this is UI-Only, you’ll have to do some magic behind the scenes (think model actions or field interactions) if you want users to be able to edit fields on this model and have the edits saved back to the database.

C. Spoofing things in the table

In your Table you can use merge syntax in template fields if you want to show multiple fields in one. Conditional merge expressions are also :fire: