# Adding several time the same entity in a shot breakdown

**URL:** <https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154>\
**Category:** Flow Production Tracking\
**Tags:** connection-entities\
**Created:** [February 6, 2020, 8:44pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154 "2020-02-06T20:44:44Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![benwall](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/benwall/32/1386_2.png) [@benwall](https://community.shotgridsoftware.com/u/benwall)\
**Post date:** [February 6, 2020, 8:44pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/1 "2020-02-06T20:44:44Z")

</div>

Hi there,  
We are planning on using the Shot entity field `assets` to get the asset breackdown list in several tools.

It seems it’s currently impossible to add several times the same asset in this field:

 ![image](https://global.discourse-cdn.com/shotgunsoftware/original/2X/9/96ee36545fe4cfc920efb90b2a64aa80cc5bb5c7.png)

 ![image](https://global.discourse-cdn.com/shotgunsoftware/original/2X/5/5180fb5614fe018bba4723ec8e074cea5ca198a6.png)

I guess multi entity fields are dictionnaries, as it’s impossible to use a calculate field to get them either:

> ‘assets’ type (Multi-Entity) is not supported in calculated fields. Currently supported types are (Calculated, Currency, Duration, Float, List, Number, Percent, Text)

Is there a way to link assets to a shot in a list, so that we can multiply the same entries?  
Simply getting the asset name would be ok as long as user can only enter real Asset entities names

---

<div class="post-metadata">

**Author:** ![Beth](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/beth/32/117_2.png) [@Beth](https://community.shotgridsoftware.com/u/Beth)\
**Post date:** [February 7, 2020, 1:22am UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/2 "2020-02-07T01:22:24Z")

</div>

Hi @benwall,

Thanks for your message - the `Assets` field on the Shot entity will only allow you to populate Assets that already exist, as long as they don’t have “Create” permissions for Assets. When you try and populate an Asset that doesn’t exist, a little prompt asks if you want to create this Asset, but if you have permission turned off, it won’t let the user do this.

![Screen Shot 2020-02-06 at 5.20.48 PM](https://global.discourse-cdn.com/shotgunsoftware/original/2X/5/50f85cbf9f78afb5d15bb922de9759c7d07cfd8b.png)

It is not possible, however, to have the same Asset listed more than once.

May I ask what your reason is for needing to add the same Asset multiple times? Are you trying to log the number of times that specific Asset was used in that Shot?

Cheers,  
Beth

---

<div class="post-metadata">

**Author:** ![benwall](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/benwall/32/1386_2.png) [@benwall](https://community.shotgridsoftware.com/u/benwall)\
**Post date:** [February 7, 2020, 8:06am UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/3 "2020-02-07T08:06:10Z")

</div>

> [@Beth](#):
>
> May I ask what your reason is for needing to add the same Asset multiple times? Are you trying to log the number of times that specific Asset was used in that Shot?

I am working on a tool which will build maya shot scenes from the ground up, based on shot assets list.  
We may need to load several time an asset in the 3d scene (in my screenshot in first post, we would need the prop “ballon” twice for instance)

Is there any other way to easily list assets on a shot?

---

<div class="post-metadata">

**Author:** ![benwall](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/benwall/32/1386_2.png) [@benwall](https://community.shotgridsoftware.com/u/benwall)\
**Post date:** [February 7, 2020, 8:40am UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/4 "2020-02-07T08:40:02Z")

</div>

It seems a possible way is to use Asset Shot Connections:

> **[Using connection entities](https://support.shotgunsoftware.com/hc/en-us/articles/114094036254-Using-connection-entities)**
>
> Video transcript
> Connection entities are created automatically when there’s a link between two entities via a Multi-Entity field.
> 
> An example enabled on your site by default includes the AssetShotC...

By adding an integer field “multiple”, users can chose how many times an asset is to be loaded in a shot.

While being really practical to use the API, It seems like a really convoluted way of listing things for users:  
• They don’t get the information on the Shots page,  
• They have to use several different pages to input very closely tied data  
• They can’t easily copy paste their multiplicator

It would be way more quick and efficient for them to just list their assets in a Shot Field like ‘assets’, but which would be a list (as they would be able to populate this list with multiple instance of a same item).

Do you know of a better way?

Thanks

---

<div class="post-metadata">

**Author:** ![brandon.foster](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/brandon.foster/32/91_2.png) [@brandon.foster](https://community.shotgridsoftware.com/u/brandon.foster)\
**Post date:** [February 7, 2020, 4:26pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/5 "2020-02-07T16:26:40Z")

</div>

Hey Ben,

Connection Entities are definitely the way we’d recommend tracking something like multiple instances of a given Asset in a Shot. There are a couple of ways you could go about more quickly entering in how many instances of each across multiple Shots.

**First Method**

On your Shot detail page, ensure you’ve exposed your “Instances/Count/Quantity” field on the Assets tab. Then on your Shot page, enter into Detail view. There you can quickly switch between Shots and enter the quantities.

 ![image](https://global.discourse-cdn.com/shotgunsoftware/original/2X/6/683c071ad79e738157e784a7e5c8304ed5fb995d.jpeg)

**Second Method**

This other method involves exposing a List page for the connection entity itself. To do this first navigate to your Site Preferences \> Advanced \> Enable List Pages for Connection Entity Types. In the text entry box there, add `AssetShotConnection`. Save your changes.

Navigate back to your Project and in your “Other” menu in the project nav you should see an “AssetShotConnection” page now available that looks like the screenshot below. Here I’ve grouped the connections by their Shot, and I can quickly go down the list entering in quantities of each Asset in each Shot.

 ![Asset_Shot_Connections___Prince_and_the_Pup](https://global.discourse-cdn.com/shotgunsoftware/original/2X/b/bf1399d63674988b6e44538d925d5b69d8be1a39.png)

Let us know how either option works for you!

---

<div class="post-metadata">

**Author:** ![benwall](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/benwall/32/1386_2.png) [@benwall](https://community.shotgridsoftware.com/u/benwall)\
**Post date:** [February 7, 2020, 4:50pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/6 "2020-02-07T16:50:56Z")

</div>

I ended up using your second solution, and designed a page for users who do assets breakdown lists so that they can get both pannels side to side as widgets:

 ![image](https://global.discourse-cdn.com/shotgunsoftware/original/2X/3/34b887708a3b026dc9645be583ee80ed16377d9a.png)

It would be awesome to be able to link or instanciate filters between the two widgets.

---

<div class="post-metadata">

**Author:** ![brandon.foster](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/brandon.foster/32/91_2.png) [@brandon.foster](https://community.shotgridsoftware.com/u/brandon.foster)\
**Post date:** [February 10, 2020, 3:17pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/7 "2020-02-10T15:17:03Z")

</div>

Great solution with the canvas widgets! I agree, a page-wide filter that could affect multiple widgets at once would be useful. You can send your ideas directly to the product team; [this post explains how](https://community.shotgridsoftware.com/t/how-do-i-submit-an-idea-or-feature-request/253).

---

<div class="post-metadata">

**Author:** ![brycegbrazen](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@brycegbrazen](https://community.shotgridsoftware.com/u/brycegbrazen)\
**Post date:** [February 9, 2024, 6:15pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/8 "2024-02-09T18:15:38Z")

</div>

Hi all,

Just wanted to clarify, does the Shotgrid DB use the two entities used in the connection as the primary key in the database?

For example, with the AssetShotConnections entity mentioned above, when I try to create a new AssetShotConnection instance with the same Asset/Shot values that already exist in another instance, I get this error message:  
 ![creation_failure](https://global.discourse-cdn.com/shotgunsoftware/original/2X/0/03704e25261909eb8b871d439f28e55547069660.png)

My desired setup on this entity is to be able to have multiple AssetShotConnection entities that share the same Asset/Shot connection, but other fields are different.  
For example, if I had an “Instance Number” field to keep track of each individual instance of an Asset in a Shot, like this:  
 ![AssetShotConnectionsFinal](https://global.discourse-cdn.com/shotgunsoftware/original/2X/1/15782fe5aa3be701736ea62f9bb1937c2d5a93d4.png)  
then I could store other things unique to this connection, such as PublishedFile entities that are specific to a certain character.

With this method, on the “Shots” page, I would like to be able to also merge two fields to create a unique display name for each of these AssetShotConnection entities like this:

 ![shots](https://global.discourse-cdn.com/shotgunsoftware/original/2X/a/a76f11fded4b1a58cb7d34a75568e10f8b79c07a.png)

I’m just curious as to why ShotGrid seems to use both entities in a Connection entity as the primary key (as shown by the error above), rather than just use the ID field like every other kind of entity in the DB.

---

<div class="post-metadata">

**Author:** ![Ricardo\_Musch](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/ricardo_musch/32/405_2.png) [@Ricardo\_Musch](https://community.shotgridsoftware.com/u/Ricardo_Musch)\
**Post date:** [February 14, 2024, 12:44am UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/9 "2024-02-14T00:44:10Z")

</div>

My guess is because its not a many to many relationship but a one to many both ways:

`one Asset to many Shots` ↔ `many Shots to one Asset`

Something similar to a Connection Entity is definitely what you want here but its likely a `CustomProjectEntity`. A `Variation` of an Asset.

I.e.

SH\_0010 ↔ Monster\_Variation\_young\_1 ↔ Asset: Monster  
SH\_0010 ↔ Monster\_Variation\_young\_2 ↔ Asset: Monster  
SH\_0010 ↔ Monster\_Variation\_old\_1 ↔ Asset: Monster  
SH\_0010 ↔ Monster\_Variation\_dead\_1 ↔ Asset: Monster

You could make this more complex by adding a `Variation Group` so that you can publish files to a `Variation Group` and not its individual variation, but use the `Variation` entity to track the Shot Build table.

---

<div class="post-metadata">

**Author:** ![daniel.sauve](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/daniel.sauve/32/4914_2.png) [@daniel.sauve](https://community.shotgridsoftware.com/u/daniel.sauve)\
**Post date:** [February 19, 2024, 4:05pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/10 "2024-02-19T16:05:00Z")

</div>

Hello brycegbrazen,

When someone creates a multi-entity field it creates a new database table that contains a unique constraint on the id of the two entities used in the connection. Connection entities are not behaving like others entities, they are a way to do a many-to-many connection but it cannot contains duplicate. Also, multi-entity fields are not available on connection entities.

With the details given I can think of 3 ways of storing the informations:

- Duplicating the asset entities for each different PublishedFile and use those in the connection entities
- You cloud also create another multi-entity field per instance, but that does not scale well
- Use a customEntity to define the different instances like Ricardo suggested

I believe that Ricardo’s idea should provide less data duplication…

---

<div class="post-metadata">

**Author:** ![brycegbrazen](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@brycegbrazen](https://community.shotgridsoftware.com/u/brycegbrazen)\
**Post date:** [February 20, 2024, 6:20pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/11 "2024-02-20T18:20:01Z")

</div>

> [@daniel.sauve](#):
>
> Connection entities are not behaving like others entities, there are a way to do a many-to-many connection but it cannot contains duplicate.

Can you explain what you mean by “there are a way to do a many-to-many connection…”? Can you perhaps provide an example of what you mean?

> [@daniel.sauve](#):
>
> You cloud also create another multi-entity field per instance, but that does not scale well

Can you explain this more as well? I thought you just said in the paragraph above that multi-entity fields are not available on connection entities?

What exactly the reasoning behind Connection Entities using the id of the two entities used in the connection as the primary key in the database? Isn’t this just locking down functionality for users? It would be great to know _why_ the database was architected in this way, because right now it just seems like it may just be causing needless roadblocks for users like me.

---

<div class="post-metadata">

**Author:** ![daniel.sauve](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/daniel.sauve/32/4914_2.png) [@daniel.sauve](https://community.shotgridsoftware.com/u/daniel.sauve)\
**Post date:** [February 20, 2024, 6:36pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/12 "2024-02-20T18:36:41Z")

</div>

Hello Bryce,  
For the first topic I mean they (connection entities) are a way of doing many to many connection

As for the second topic, (like I said it does not scale well)  
that would be to create multiple multi-entity field on Asset that allows shot and that could be named instance1, instance2, …, instanceX

Now about the database architecture, the connection entities were designed to provided additionnal details when two entities are linked together. Treating the connection entities like all other entities would bring some technical complications. It could be propose as a feature request.

---

<div class="post-metadata">

**Author:** ![Ricardo\_Musch](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/ricardo_musch/32/405_2.png) [@Ricardo\_Musch](https://community.shotgridsoftware.com/u/Ricardo_Musch)\
**Post date:** [February 20, 2024, 8:07pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/13 "2024-02-20T20:07:07Z")

</div>

To piggy back on this,

an example of a Connection Entity and it’s functionality is the `PlaylistVersionConnection` entity that can store some additional playlist specific version info.

For example, it stores the `Reason for Review` field which is the Version Description as displayed in the Client Review site, and is playlist specific (but linked to the Version).

---

<div class="post-metadata">

**Author:** ![brycegbrazen](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@brycegbrazen](https://community.shotgridsoftware.com/u/brycegbrazen)\
**Post date:** [February 20, 2024, 11:06pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/14 "2024-02-20T23:06:40Z")

</div>

@daniel.sauve,

I did some reading on DB architecture so I can better say what I’m trying to achieve. I did a quick UML mockup with Vertabelo (I did not add all fields on each entity in the diagram for simplicity).

I think what I’d like to be able to do is add a new field (instance) to the AssetShotConnections (renamed here to AssetInstances), where I also use this new field (instance) as an additional primary key (PK) in the database. I want it to serve the same purpose as a many-to-many relationship of assets to shots, but to enforce uniqueness based on 3 fields: asset\_id, shot\_id and instance.

 ![image](https://global.discourse-cdn.com/shotgunsoftware/original/2X/2/23c467ad2aa2f552f28665e289531063e1529f2b.png)  
Note: (FK) is foreign key in the above diagram

As a side note, this would allow us to associate a published file with a particular AssetInstance, which would be nice.

Is it possible to set what fields are primary keys in ShotGrid right now? If not, I can create a new `CustomProjectEntity` as mentioned by Ricardo, but that new entity would have `id` as the PK in the database, instead of the 3 fields mentioned above. Therefore I would have to enforce uniqueness manually when creating new AssetInstance instances by first querying the ones that already exist with the above 3 primary keys.

---

<div class="post-metadata">

**Author:** ![schicky](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/schicky/32/506_2.png) [@schicky](https://community.shotgridsoftware.com/u/schicky)\
**Post date:** [February 21, 2024, 12:23am UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/15 "2024-02-21T00:23:26Z")

</div>

Would this work?  
Actually create the Asset instances as Assets, and then link them to a Parent Asset using the existing Parent Asset/Sub-Assets fields? The missing part would be the link between the Shot and the Parent Asset, but you could write an Event Daemon to make that link based on Sub-Asset activity

---

<div class="post-metadata">

**Author:** ![Ricardo\_Musch](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/ricardo_musch/32/405_2.png) [@Ricardo\_Musch](https://community.shotgridsoftware.com/u/Ricardo_Musch)\
**Post date:** [February 21, 2024, 12:56am UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/16 "2024-02-21T00:56:40Z")

</div>

Yeah that would also work, either that or a CustomProjectEntity.

> [@brycegbrazen](#):
>
> Is it possible to set what fields are primary keys in ShotGrid right now? If not, I can create a new `CustomProjectEntity` as mentioned by Ricardo, but that new entity would have `id` as the PK in the database, instead of the 3 fields mentioned above. Therefore I would have to enforce uniqueness manually when creating new AssetInstance instances by first querying the ones that already exist with the above 3 primary keys.

You are not able to alter the ShotGrid Database in that way (altering the primary keys etc) considering the ShotGrid product runs on top.

However I would argue that you don’t need to either as we already offer viable solutions above. The experience can be improved with some custom tools to aid in the Shot Build workflow or some alterations to your Toolkit code.  
As well as some design changes and custom page setups in the Web UI.

> [@brycegbrazen](#):
>
> As a side note, this would allow us to associate a published file with a particular AssetInstance, which would be nice.

You can already do this if you would architect your schema to use either the Parent Asset/Sub Asset workflow or by adding a CustomProjectEntity.

---

<div class="post-metadata">

**Author:** ![daniel.sauve](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/daniel.sauve/32/4914_2.png) [@daniel.sauve](https://community.shotgridsoftware.com/u/daniel.sauve)\
**Post date:** [February 21, 2024, 2:35pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/17 "2024-02-21T14:35:36Z")

</div>

Hello @brycegbrazen ,  
I dont have the details on how all of those would be used but the schema that @Ricardo_Musch proposed should not have primary key validation to do on your end:

A customEntity(Instance) with:

- an Entity field that points on Assets
- a Multi-entity field that point on Shots

And on the resulting instance\_shot\_connection entity:

- an entity field that point on published files

![db-structure](https://global.discourse-cdn.com/shotgunsoftware/original/2X/9/9abbf452160e66d418c3231f5ab9d9df6138b5d7.png)

---

<div class="post-metadata">

**Author:** ![Ricardo\_Musch](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/ricardo_musch/32/405_2.png) [@Ricardo\_Musch](https://community.shotgridsoftware.com/u/Ricardo_Musch)\
**Post date:** [February 21, 2024, 5:18pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/18 "2024-02-21T17:18:47Z")

</div>

Out of interest, what is this fancy software that makes such nice charts? 👀

---

<div class="post-metadata">

**Author:** ![daniel.sauve](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/daniel.sauve/32/4914_2.png) [@daniel.sauve](https://community.shotgridsoftware.com/u/daniel.sauve)\
**Post date:** [February 21, 2024, 5:23pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/19 "2024-02-21T17:23:25Z")

</div>

I tried quickly with mermaid.live but it was more easy for me to just create the DB and use the graph viewer of [https://dbeaver.io/](https://dbeaver.io/)

---

<div class="post-metadata">

**Author:** ![Ricardo\_Musch](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/ricardo_musch/32/405_2.png) [@Ricardo\_Musch](https://community.shotgridsoftware.com/u/Ricardo_Musch)\
**Post date:** [February 21, 2024, 5:27pm UTC](https://community.shotgridsoftware.com/t/adding-several-time-the-same-entity-in-a-shot-breakdown/7154/20 "2024-02-21T17:27:15Z")

</div>

Awesome, thanks for the tip!
