Entity under two roots?

Is it possible to have an entity folder appear under two different roots?
I tried to get the filters working such that a Shot linked to a Sequence only gets created on rootA, and if it’s not linked to a sequence it only gets created on rootB, but I couldn’t get the filter to work as SG complains about the fact the Shot has a required field sg_sequence.

How do I tell SG via the schema not to create folders if a certain field is empty?

This is the method where it’s erroring :

And my stack trace :

>>> pprint.pformat(tk.preview_filesystem_structure('Shot',  3804))
Traceback (most recent call last):
  File "c:\Program Files\Shotgun\Resources\Desktop\Python\bundle_cache\app_store\tk-multi-pythonconsole\v1.3.1\python\app\input_widget.py", line 230, in execute
    results = eval(python_code, self._locals, self._locals)
  File "<python input>", line 1, in <module>
  File "C:\Users\pmacdonald\AppData\Roaming\Shotgun\fth\p1553c4238.basic.desktop\cfg\install\core\python\tank\api.py", line 933, in preview_filesystem_structure
    self, entity_type, entity_id, True, engine
  File "C:\Users\pmacdonald\AppData\Roaming\Shotgun\fth\p1553c4238.basic.desktop\cfg\install\core\python\tank\folder\operations.py", line 216, in process_filesystem_structure
    tk, config, io_receiver, i["type"], i["id"], i["sg_task_data"], engine
  File "C:\Users\pmacdonald\AppData\Roaming\Shotgun\fth\p1553c4238.basic.desktop\cfg\install\core\python\tank\folder\operations.py", line 58, in create_single_folder_item
    tk.shotgun, entity_id_seed
  File "C:\Users\pmacdonald\AppData\Roaming\Shotgun\fth\p1553c4238.basic.desktop\cfg\install\core\python\tank\folder\folder_types\entity.py", line 395, in extract_shotgun_data_upwards
    "again!\n" % (self._entity_type, name, field)
tank.errors.TankError: The Sequence myshot has a required field sg_sequence that 
does not have a value set in Flow Production Tracking. 
Double check the values and try again!

I figured this out.
If you need to filter using a field that some entities may have undefined, then you need to first add relation “is_not” and then [ null ], before you then add the condition you need for the entities that DO have this value.

filters: [
  { "path": "project", "relation": "is", "values": [ "$secondary" ] } ,
  { "path": "sg_foo", "relation": "is_not", "values": [ null ] },
  { "path": "sg_foo", "relation": "is", "values": ["$foo"] }
1 Like