Avatar

Correct answer by
Community Advisor

Hello @_lukas_,

I always look how out-of-the-box fields are done. Your example is exactly the same as country field in nms:recipient. Except that the state link (conditional select based on previous selection) in your case is not needed.

 

See the schema nms:recipient

 <element externalJoin="true" label="Country/Region" name="country" revIntegrity="normal"
             revLink="recipient" target="nms:country" type="link">
      <join xpath-dst="@isoA2" xpath-src="location/@countryCode"/>
    </element>
    <element desc="State/Province" externalJoin="true" label="State" name="stateLink"
             revLink="recipient" target="nms:state" type="link">
      <join xpath-dst="@code" xpath-src="location/@stateCode"/>
      <join xpath-dst="@countryCode" xpath-src="location/@countryCode"/>
    </element>

See the input form nms:recipient

    <input choiceButton="true" createMode="none" extraColumns="@isoA2,@isoA3" noZoom="true"
           xpath="../country">
      <orderBy>
        <node expr="@label"/>
      </orderBy>
      <enter name="onChange">
        <set value="" xpath="../location/@stateCode"/>
        <reset xpath="../stateLink"/>
      </enter>
    </input>
    <input choiceButton="true" createMode="none" extraColumns="@code,@countryCode"
           noZoom="true" notifyPathList="country/@label|../country/@_cs,@countryCode|../location/@countryCode,country|../country"
           xpath="../stateLink">

      <sysFilter>
        <condition expr="@countryCode = $(../location/@countryCode)"/>
      </sysFilter>
      <orderBy>
        <node expr="@label"/>
      </orderBy>
    </input>

This also applies for all the custom objects you want to create, it is good to look at the ootb objects apart from the documentation

 

Marcel

View solution in original post