Link a field to an existing reference table
Learn how to link a field to an existing reference table.

Introduction

This article demonstrates how you can use an existing reference table as an alternative to built-in Adobe Campaign enumeration mechanisms (enum, userEnum, or dbEnum).

You can also use an existing reference table as an enumeration in your schemas. This can be achieved by creating a link between a table and the reference table, and by adding the attribute displayAsField="true".

Example

The reference table contains a list of bank names and identifiers:

<srcSchema entitySchema="xtk:srcSchema" img="cus:bank16x16.png" label="Bank" mappingType="sql" name="bank" namespace="cus"
xtkschema="xtk:srcSchema">
    <element img="cus:bank16x16.png" label="Banks" name="bank">
        <compute-string expr="@name"/>
        <key name="id">
            <keyfield xpath="@id"/>
        </key>
        <attribute label="Bank Id" name="id" type="short"/>
        <attribute label="Name" length="64" name="name" type="string"/>
     </element> 
</srcSchema>

In any table using this reference table, define a link and add the displayAsField="true" attribute.

<element displayAsField="true" label="Bank" name="bank" target="cus:bank" type="link" noDbIndex="true"/>

The user interface will not display a link but a field. When the user picks that field, he can select a value from the reference table or use the auto-complete feature.

interface1

Additional notes

  • In order for it to auto-complete, you must define a compute-string in the reference table.
  • Add the noDbIndex="true" attribute in the link definition to prevent Adobe Campaign from creating an index on the values stored in the source table of the link.