# How to define a cross reference table or codelist in XML to X12  mapping?

**URL:** <https://community.cdata.com/t/how-to-define-a-cross-reference-table-or-codelist-in-xml-to-x12-mapping/378>\
**Category:** CData Arc\
**Tags:** question\
**Created:** [September 6, 2023, 10:51am UTC](https://community.cdata.com/t/how-to-define-a-cross-reference-table-or-codelist-in-xml-to-x12-mapping/378 "2023-09-06T10:51:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PukhrajChoudhary](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@PukhrajChoudhary](https://community.cdata.com/u/PukhrajChoudhary)\
**Post date:** [September 6, 2023, 10:51am UTC](https://community.cdata.com/t/how-to-define-a-cross-reference-table-or-codelist-in-xml-to-x12-mapping/378/1 "2023-09-06T10:51:16Z")

</div>

How to define a cross reference table or codelist in XML to X12&nbsp; mapping?

Collect = CC

Prepaid = PP

Per Contract = DE

---

<div class="post-metadata">

**Author:** ![James\_B](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/james_b/32/1688_2.png) [@James\_B](https://community.cdata.com/u/James_B)\
**Post date:** [September 6, 2023, 5:12pm UTC](https://community.cdata.com/t/how-to-define-a-cross-reference-table-or-codelist-in-xml-to-x12-mapping/378/2 "2023-09-06T17:12:25Z")

</div>

This is something that you would want to address in a previous step in the flow, prior to generating the XML for the X12 connector to translate. There are multiple ways to approach this, but in general, I would recommend that you do one of the following:

1. Use a set of conditionals in the XML Map to map alternate conditions to the same element (use for small numbers of values)

[Conditionals](https://cdn.cdata.com/help/AZJ/mft/XML-Map-Conditionals.html)

To do this, you’ll want to create multiple nodes in your XML file that are mapped to the same value, but have alternate conditionals applied:

![f93e2dea-cd82-4b17-93fe-b89857f8136c.png](https://us1.discourse-cdn.com/cdata/original/1X/745a642f37f61cc5f66d8fc4fda7f2dbe18c93d3.png)

For each conditional, use a different value in the condition, and hard code the expression:

 ![e4ea802e-bb21-4be4-af9c-d993b968c653.png](https://us1.discourse-cdn.com/cdata/original/1X/1e582dce02ec7c32a90035676209b69c814d9d8b.png)

1. Use the Custom Script to create a select/case statement for that node for a larger finite list using the arc:select and arc:case keywords. Whatever is set in result.text before the code block exists will be the result:

[arc:select](https://cdn.cdata.com/help/AZJ/mft/op_arcSelect.html)

[arc:case](https://cdn.cdata.com/help/AZJ/mft/op_arcCase.html)

 ![92f3811e-1d72-430f-a3d7-948fd1562b44.png](https://us1.discourse-cdn.com/cdata/original/1X/d775bef0bd1f248db58c6e1d863c700a02c3f221.png)

If you have a larger list to sort through, you can use the

1. Use the Lookup Action of a corresponding database connection to look up the value from a table where those values are stored (for large lists or ones that require dynamic updates)

[Lookup](https://cdn.cdata.com/help/AZJ/mft/Database-Lookup.html)

This would be used as a separate processing step in your flow instead of being used within XML Map, but for queries that would return a single value (which can be repeated if there are multiple matching XPaths for the lookup), this will amend the XML to include a new node in the output, which you can map against directly in the XML Map step

 ![558efc65-3d40-44e9-9893-1562dc272b64.png](https://us1.discourse-cdn.com/cdata/original/1X/529410c9681cc0d6b923409c058553b82e4d9d62.png)
