$catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
You can use item expressions in a nested way, in cases where a lookup attribute is a reference to itself.
In the following example:
the catalogVersion attribute refers to a CatalogVersion item that is looked up:
using its catalog and version attribute.
Within the catalog is a reference to itself (to a Catalog item) that is looked up using the id attribute:
INSERT Product; code; unit(code); catalogVersion(catalog(id), version)
;testCode; pieces; clothescatalog:Staged