11-15-2019, 02:06 PM
Collections are a more formal implementation of what you are trying to do, however, there is nothing magic about them. There are somethings to be aware of. Although connections between sobjects specify a direction where "from" is the child and "to" is the parent, the expression language and other functions allow for a connections to go both ways.
For example, both are possible with a single connection:
@SOBJECT(vfx/asset.sthpw/task)
@SOBJECT(sthpw/task.vfx/asset)
This presents a problem with the example Diego provided. How does the expression language know which "path" to take because both connections satisfy the above expressions. By default the expression language will take the first definition. What is needed is a way to specify which connection to use. This is done with the "path" attribute.
<connect from="prj/asset_in_asset" to="prj/asset" relationship="code" from_col="parent_asset_code" to_col="code" path="parent"/>
<connect from="prj/asset_in_asset" to="prj/asset" relationship="code" from_col="child_asset_code" to_col="code" path="child"/>
So, in the expression language, you could use:
@SOBJECT(prj/asset.parent:prj/asset_in_asset.child:prj/asset)
You will also see other functions in the api which have a "path" argument. This refers to the above. In the case of connection an table to itself, you must use the path attribute.
For example, both are possible with a single connection:
@SOBJECT(vfx/asset.sthpw/task)
@SOBJECT(sthpw/task.vfx/asset)
This presents a problem with the example Diego provided. How does the expression language know which "path" to take because both connections satisfy the above expressions. By default the expression language will take the first definition. What is needed is a way to specify which connection to use. This is done with the "path" attribute.
<connect from="prj/asset_in_asset" to="prj/asset" relationship="code" from_col="parent_asset_code" to_col="code" path="parent"/>
<connect from="prj/asset_in_asset" to="prj/asset" relationship="code" from_col="child_asset_code" to_col="code" path="child"/>
So, in the expression language, you could use:
@SOBJECT(prj/asset.parent:prj/asset_in_asset.child:prj/asset)
You will also see other functions in the api which have a "path" argument. This refers to the above. In the case of connection an table to itself, you must use the path attribute.