Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Extend a Schema

davidm1708369
Level 2
Level 2

How can I add an enumeration to the existing state field in the Delivery table. 

In a similar way how can I change the length of an existing field in the recipient(profile) table.  E.G. change length of first name from 30 to 50 characters? 

1 Accepted Solution
CedricRey
Correct answer by
Level 5
Level 5

Hello @davidm1708369 

You can use the schema extension, this is exacly what it does.

You have to create a new schema (usually, we use the same name, and a custom namespace, ex: nms:recipient => cus:recipient), with the specific attribute "extendedSchema" on the main "srcSchema" element. If you use the schema creation Wizard, you'll see the "Schema Extension" option that guide you for the creation.

<srcSchema entitySchema="xtk:srcSchema"
           extendedSchema="nms:recipient" name="recipient"
           namespace="cus" xtkschema="xtk:srcSchema">

  <enumeration basetype="byte" name="newEnum">
    <value label="Value 0" name="value0" value="0"/>
    <value label="Value 1" name="value1" value="1"/>
  </enumeration>

<element name="recipient">
<!-- New element/attribute creation-->
<attribute name="myNewAttribute" enum="newEnum" type="byte"/>

<!--Override existing attribute spec by targeting its name-->
<attribute length="50" name="firstName"/>
</element>

</srcSchema>

 That way you can also add values into an existing enumeration.

 

Cedric

View solution in original post

2 Replies
CedricRey
Correct answer by
Level 5
Level 5

Hello @davidm1708369 

You can use the schema extension, this is exacly what it does.

You have to create a new schema (usually, we use the same name, and a custom namespace, ex: nms:recipient => cus:recipient), with the specific attribute "extendedSchema" on the main "srcSchema" element. If you use the schema creation Wizard, you'll see the "Schema Extension" option that guide you for the creation.

<srcSchema entitySchema="xtk:srcSchema"
           extendedSchema="nms:recipient" name="recipient"
           namespace="cus" xtkschema="xtk:srcSchema">

  <enumeration basetype="byte" name="newEnum">
    <value label="Value 0" name="value0" value="0"/>
    <value label="Value 1" name="value1" value="1"/>
  </enumeration>

<element name="recipient">
<!-- New element/attribute creation-->
<attribute name="myNewAttribute" enum="newEnum" type="byte"/>

<!--Override existing attribute spec by targeting its name-->
<attribute length="50" name="firstName"/>
</element>

</srcSchema>

 That way you can also add values into an existing enumeration.

 

Cedric

View solution in original post

davidm1708369
Level 2
Level 2
Sorry I posted this in wrong area. This is actually an ACS question and I'll re-post