Mapping Templates

Turn external spreadsheet columns into consistent, reusable bulk imports.

Mapping Templates in Compound Direct define how the columns in a CSV or Excel (.xlsx) file correspond to customer, prescriber, product, prescription, draft, order, account, delivery, and e-prescription information. A mapping template is required before starting a bulk import, and can be reused whenever a source file follows the same layout.


Templates can also supply default values, require important information, and apply rules that standardise or validate each row before it is imported. Setting up the template carefully reduces repeated data entry and makes each bulk import easier to review.

This guide will help you:

  • Create a mapping template from an existing spreadsheet or by selecting mapped fields.
  • Configure source columns, default values, required fields, and mapping rules.
  • Clean source values, split a row into several items, and prepare full addresses for lookup.

  • Partition one spreadsheet into separate bulk imports.
  • Download a blank CSV template, start an import, and manage existing templates.

A mapping template is a prerequisite for bulk importing drafts. Once your template is ready, see the Bulk Imports guide.

  1. Click the settings gear icon in the top-right navigation bar to open ‘Workspace settings’.
  2. In the left-hand side menu, under ‘Templates’, select ‘map Mapping Templates’.
  3. The ‘Mapping Templates’ page shows ‘Template Name’, with the description below the name, followed by the ‘Modified’ and ‘Last Used’ dates.
  4. Begin typing the template name in the search search bar to refine the list.
  5. Click the desired ‘Mapping Template’ to view or edit it.

Alternatively, find a template through the ‘Bulk Import Dashboard’:


  1. Click ‘More keyboard_arrow_down’ in the top navigation bar to open the drop-down menu.
  2. In the drop-down menu, under ‘Advanced’, select the ‘table_view Bulk Imports’ link.
  3. Click ‘Manage Templates’ on the ‘Bulk Import Dashboard’.
  4. Find and open the template in the ‘Mapping Templates’ list.

Before creating a template, identify which columns your source system provides and which Compound Direct fields they should populate.

  1. Use one row per item, or use a splitting rule when a row contains several eScripts or a list of items.
  2. Keep the source column headings consistent between files. A saved Source column should match the corresponding spreadsheet heading.
  3. Include enough information to identify the required customer and product for every active row.
  4. Add prescription, prescriber, delivery, account, or order fields only when they are needed for your workflow.
  5. Decide which values are supplied by the spreadsheet and which should be supplied by a template Default Value.
  6. Decide which fields must be completed before drafts can be created, then mark those mappings as Required.
  7. If one file should create separate imports, decide which source value will be used as the Partition Code.

Available mapped fields reflect the features enabled in your workspace. For example, order, account, veterinary, and e-prescription fields only appear when the related functionality is available.

  1. Click the settings gear icon in the top-right navigation bar to open ‘Workspace settings’.
  2. In the left-hand side menu, under ‘Templates’, select ‘map Mapping Templates’.
  3. Click ‘Create Template’.
  4. Enter a clear Template Name.
  5. Enter a Description that identifies the source system, file type, or intended workflow.
  6. Build the ‘Column Mapping’ in either of the following ways:
    1. To scan an existing layout, upload or drag and drop one .csv or .xlsx file into ‘Upload import file to be scanned’.
      1. Set ‘Read Offset’ to the number of rows above the headings (for example, 2 skips two introductory rows). The next row supplies the headings. If an Excel workbook has multiple sheets, choose ‘Worksheet’.
      2. Where a heading resembles an available Compound Direct field name, the corresponding Mapped field is selected automatically.
      3. Review every automatically selected field before saving.
    2. To build the template manually, click ‘Add Mapped Field’ or ‘Add Mapped Fields’.
      1. Search for a field or expand a category.
      2. Tick each field you want the template to support.
      3. Click ‘Done’.
  7. Configure each row in ‘Column Mapping’:
    1. In ‘Source column’, enter the heading used in the spreadsheet.
    2. In ‘Default Value’, optionally enter a value to use when the source value is blank or the source column is not supplied.
    3. Tick ‘Required’ when the mapped value must be present before the item can proceed.
    4. Under ‘Mapped field’, select the Compound Direct field that receives the value.
  8. Drag the reorder icon to arrange the mappings in a practical review order.
  9. To remove a mapping, click the delete_outline icon beside it.
  10. Add any required mapping or splitting rules. Hover over or focus an info_outline help icon for explanations and examples.
  11. Click ‘Create Template’.

Each direct mapping must have a Mapped field, and each mapped field can only be used once. A column used only in a rule does not need a direct mapping: enter its heading in the rule’s source-column selector.

Each mapping row controls how one value is prepared for the import.

SettingHow to use it
Source columnEnter the spreadsheet heading that contains the value. Keep the spelling and spacing consistent with the source file.
Default ValueEnter a value to use when the source cell is blank or the column is absent. A default is useful for values shared by every row, such as an order workflow or tag.
RequiredTick this when an empty value should be treated as an issue that must be resolved before draft creation.
Mapped fieldSelect the Compound Direct field that will receive and use the value.

When you use ‘Get Template’, columns with a Default Value are omitted from the downloaded file because the template can supply those values automatically.

Common mapped-field formats

  1. Enter dates in your workspace date format or as YYYY-MM-DD.
  2. For a Yes/No field, use TRUE, YES, Y, or 1 for Yes. Other or blank values are treated as No.
  3. Separate multiple tags with commas in fields such as Tags, Customer Tags, or Order Tags.
  4. Enter percentages as numbers between 0 and 100 where a percentage field is used.
  5. Enter currency and quantities as numbers without explanatory text.

Mapped fields that affect later processing

FieldUser-facing effect
Partition CodeSeparates rows into individual bulk imports. Rows with the same code remain together; blank codes form an Unpartitioned import when other rows contain a code.
Is StarredMarks the row with a star so it remains easy to identify as it moves through the import workflow.
Row CommentAdds an operational note that remains available with the import row during drafting, queuing, and review.
Row ReferenceAdds an external or internal identifier that remains available with the import row throughout the workflow.
Customer ID / Prescriber IDUses the existing Compound Direct record with that ID. An invalid ID must be corrected during reconciliation.
Min Match % / Min Name Match %Sets the minimum customer matching thresholds for that row. Use values from 0 to 100.
Product NameProvides the product search term used during reconciliation. Always verify the selected product before creating drafts.
Product CodeSupplies the formulation or stock reference code from the source file. Include Product Name as well unless your tested source workflow reliably resolves by code.
Price NameSelects a named drug multipack or formulation price when that name is available.
Repeat On FileAttempts to create the draft from an eligible existing repeat for the same customer and product.
BarcodeImports one supported e-prescription item. A barcode cannot be reused by another row in the same import.
E-Script Repeat EmailSets the email address that should receive the repeat token.
Purchase Order NoGroups rows with the same purchase order number into one order, unless grouping by customer is enabled.
Group Order By CustomerGroups all eligible rows for the same matched customer into one order.
Order WorkflowApplies the named order workflow. Use the exact workflow name where possible.
Discount Percentage / Discount AmountApplies one form of discount. Do not provide both for the same row.
Discount Applied To ItemApplies the discount to the line item instead of the whole order.
Item Is ArchivedExcludes the row from draft creation. A partition group is not created when every row in that group is archived.

For the complete set of available fields and their descriptions, click ‘Add Mapped Fields’ and expand the Customer, Prescriber, Delivery Address, Product, Prescription, Draft, Order, Account, ePrescription, and Mapping categories.

When address lookup is enabled for your workspace, map a complete address to ‘Customer Address (Lookup)’ or ‘Delivery Address (Lookup)’. These fields retain the imported address and request lookup during bulk-import reconciliation; the template itself does not look up the address.


  1. Open the template and click ‘Add Mapped Fields’.
  2. Select ‘Customer Address (Lookup)’ under Customer or ‘Delivery Address (Lookup)’ under Delivery Address.
  3. Set ‘Source column’ to the heading containing the complete address, then click ‘Save Template’.
  4. Start the import and review the result in ‘Drafting’. A successful lookup fills street address, address line 2, suburb, city, state and postcode where supplied by the address provider.

An unresolved address needs review before the row can proceed. See

Resolving imported addresses

for searching again, choosing a result or entering the parts manually. If your file already has separate address parts, you can map those directly without a lookup field.

Partitioning uses a value on each spreadsheet row to split one uploaded file into separate bulk imports. This is useful when one source file contains groups that should be reviewed and processed independently.

  1. Create or open a mapping template.
  2. Under ‘Column Mapping’, click ‘Add Mapped Fields’.
  3. Expand ‘Mapping’ and select ‘Partition Code’.
  4. Choose how the code will be supplied:
    1. Map a spreadsheet heading that already contains the required code.
    2. Enter a Default Value when every row should receive the same code. This produces one named import unless a mapping rule changes the code for some rows.
    3. Use a Mapping Rule to copy, standardise, or construct the code from other source data.
  5. Click ‘Save Template’.
  6. Use the template to start a spreadsheet import and review the partition groups before creating the imports.

Partition codes are trimmed and compared without regard to capitalisation. For example, values that differ only by leading spaces or upper- and lower-case letters are treated as the same partition.

When at least one row has a Partition Code, rows with a blank code are grouped into a separate ‘Unpartitioned’ import. Make the field Required or add a mapping-rule error if blank codes should never be accepted.

See

Partitioning a bulk import

for the uploaded-data review and import-creation steps.

Mapping rules use ‘When’ conditions and ‘Then’ actions to change or validate values. They can work on imported source columns even when those columns are not mapped to a Compound Direct field.


  1. Open the template and, under ‘Mapping Rules’, click ‘Add Mapping Rule’.
  2. Enter an optional ‘Rule Name’ and leave ‘Rule enabled’ on.
  3. Choose ‘Values to Update’:
    • ‘Mapped Fields’ changes the output values that will be imported, such as Barcode or Product Name.
    • ‘Source Columns’ changes a working copy of the spreadsheet values for later rules and splitting. Select a heading, or type it and press Enter. No direct column mapping is required.
  4. Under ‘When’, choose a source column or mapped field, a comparison and, when needed, a comparison value. Use ‘Add Condition’ with ‘All conditions are true (AND)’ or ‘Any condition is true (OR)’. Remove all conditions to run the rule for every row.
  5. Under ‘Then’, choose an operation and its destination. For example, copy a value, remove a prefix, trim whitespace, change a number, clear a field, or add a row error. Use ‘Add Action’ for further actions; they run from top to bottom.
  6. Under ‘Advanced’, optionally turn on ‘Skip When’ and enter conditions that prevent this rule from running.
  7. If appropriate, turn on ‘Skip Later Updates’ to protect matching output rows from later updates. In source-column mode this is ‘Skip Later Source Rules’, which stops later source-column rules for that original row. Rules that add extra rows still run.
  8. Click ‘Save Mapping Rule’, review its card, then click ‘Save Template’.

To change the sequence, drag the drag_indicator handle. Use ‘Edit’, ‘Duplicate’ or ‘Remove’ on a card to manage the rule. Turning ‘Rule enabled’ off keeps the rule saved but skips it during import; its card displays ‘Disabled’. On a narrow screen, the creation buttons read ‘Mapping Rule’ and ‘Splitting Rule’.

Direct column mapping and defaults are applied before the rules. A source-column rule runs once per original spreadsheet row and changes what later source references read; it does not rewrite the uploaded file or automatically refresh fields already mapped. To change those fields, use a mapped-field action. Place source cleanup before the split that needs it, and shared output cleanup after all rules that create rows.

‘Append current date’ and ‘Prepend current date’ use the workspace timezone and date format. All rows in the file use the same date, which is useful when adding a date to a partition code.

For a source column named Consumables containing Items: Syringe 1ml, Swab pack 10PK, remove the prefix before creating a row per item:


  1. Open the template and click ‘Add Mapping Rule’.
  2. Choose ‘Source Columns’ under ‘Values to Update’.
  3. Set ‘When’ to source column Consumables, ‘starts with’, and Items: (including the space).
  4. Set the ‘Then’ operation to ‘Remove a prefix’, choose or enter Consumables as the source column to update, and enter Items: as the prefix.
  5. Click ‘Save Mapping Rule’ and place it before the splitting rule that reads Consumables.
  6. Click ‘Save Template’.

To clear a cell unless it contains a phrase, use a source-column rule with no ‘When’ conditions and a ‘Clear the field’ action. Turn on ‘Skip When’ and add a ‘contains’ condition for the phrase you want to keep. This uses the same conditions and actions as other mapping rules; there are no separate before/after-splitting cleanup steps to configure.

A splitting rule creates one row per value and copies the other details, such as the customer and delivery address. Use it for several eScript columns or a list of items in one cell.


  1. Open the template and click ‘Add Splitting Rule’.
  2. Enter an optional ‘Rule Name’ and leave ‘Rule Enabled’ on.
  3. Choose ‘Split From’:
    • ‘Multiple Columns’: select or enter every ‘Source Columns’ heading in the order its rows should appear, including the first value.
    • ‘Separated Values in One Column’: select or enter the ‘Source Column’ and choose a ‘Separator’. Common options include comma, semicolon, pipe, new line, tab and space. You can enter a custom separator and press Enter; \n means a new line and \t means a tab.
  4. In ‘Put Each Value In’, select the output field, such as ‘Barcode’ or ‘Product Name’.
  5. Choose ‘Existing Rows’:
    • ‘Replace With Split Rows’ replaces each current row with its split rows. Use this for the main items, such as two eScripts becoming two prescription rows.
    • ‘Keep and Add Split Rows’ keeps current rows and adds the list once per original spreadsheet row. New rows start with the original column-mapped details. Use this for extras, such as consumables, that must not be repeated for every prescription row.
  6. In ‘Clear Fields’, choose any values to clear on the rows this rule creates, such as ‘Barcode’ for consumables. Other existing rows keep those values.
  7. Leave ‘Trim Spaces Around Values’ on when spaces surrounding each item should be removed.
  8. Click ‘Save Splitting Rule’, position it in the rule list, then click ‘Save Template’.

Blank values are skipped. With ‘Replace With Split Rows’, a row with no values to split stays for review with the destination cleared. With ‘Keep and Add Split Rows’, no extra rows are added. Repeated replacement rules can multiply rows: two existing rows split into two values each become four rows.

For one spreadsheet row with EScript1, EScript2 and Consumables containing Syringe 1ml, Swab pack 10PK:


  1. Map shared customer and delivery columns as usual. Add any source cleanup rules first.
  2. Add a splitting rule using ‘Multiple Columns’, ordered EScript1, EScript2, with ‘Put Each Value In’ set to ‘Barcode’ and ‘Existing Rows’ set to ‘Replace With Split Rows’.
  3. Add a second splitting rule using ‘Separated Values in One Column’, source Consumables, a comma separator and destination ‘Product Name’.
  4. Set this second rule to ‘Keep and Add Split Rows’. In ‘Clear Fields’, select ‘Barcode’ and any other prescription or product identifiers that should not carry into a consumable row, such as ‘Product Code’ or ‘Repeat On File’ if supplied by this template.
  5. Save both rules and the template, then check a sample import in ‘Uploaded’.

The result is four rows: two prescription rows, followed by one row for each consumable with blank barcodes. Customer and delivery details are copied. Consumables are added once per source row.

Both mapping and splitting flyouts offer ‘Visual’ and ‘JSON’ modes. Start in Visual to build the rule, then switch to JSON when you need an expression that the visual controls do not provide.


  1. Open the rule and switch to ‘JSON’.
  2. Edit the existing expression and resolve any validation message.
  3. Switch back to ‘Visual’ if the expression can be represented there. Otherwise continue in JSON.
  4. Click ‘Save Mapping Rule’ or ‘Save Splitting Rule’, then ‘Save Template’.

Keep a copy of a working expression before making extensive changes. Advanced expressions that cannot be shown in Visual remain editable in JSON.

  1. Save the mapping template.
  2. Click ‘Get Template file_download’ to download a blank CSV containing its source headings.
  3. Open the file and confirm that the headings match the export produced by your source system. ‘Get Template’ downloads direct mapping headings without defaults, with blank rows for ‘Read Offset’. Add any headings used only by rules or splitting if they are missing.
  4. Add a small set of representative rows, including any unusual customer, product, order, or prescription scenarios.
  5. Start a test import and review the ‘Uploaded’ and ‘Drafting’ stages before creating drafts.
  6. If columns map incorrectly or repeated issues appear, return to the mapping template, make the correction, and use a new test import.

Changing a mapping template does not remap rows that have already been added to an import. Test the updated template with a new import.

  1. Open a saved, unarchived mapping template.
  2. Ensure there are no unsaved changes.
  3. Click ‘Start Import’.
  4. In the ‘New Import’ modal, either:
    1. Upload or drag and drop a completed .csv or .xlsx file; or
    2. Click ‘Create Without File’ to add rows manually.
  5. Continue with the Starting a bulk import guide.
  1. Click the settings gear icon in the top-right navigation bar to open ‘Workspace settings’.
  2. In the left-hand side menu, under ‘Templates’, select ‘map Mapping Templates’.
  3. Select the desired template.
  4. Update the Template Name, Description, column mappings, defaults, required fields, or mapping rules.
  5. Click ‘Save Template’.

To duplicate a mapping template:

  1. Open the mapping template.
  2. Click the ‘More actions’ menu.
  3. Select ‘Duplicate Template’.
  4. Update the duplicate's name or settings, then click ‘Save Template’.

To archive or unarchive a mapping template:

  1. Open the mapping template.
  2. Click the ‘More actions’ menu.
  3. Select ‘Archive’ or ‘Unarchive’.

Archived templates cannot be selected for a new import until they are unarchived.

The table layout used during an import is saved with its mapping template, helping repeated imports use a consistent review layout.

  1. During an import, open the ‘Uploaded’, ‘Drafting’, ‘Queued’, or ‘Dispensed’ tab.
  2. Click ‘Columns’.
  3. Use ‘Search columns...’ to find a field in a long list.
  4. Tick the fields you want displayed and untick fields you want hidden.
  5. Click ‘Done’.
  6. Drag a column boundary to resize it, or double-click the boundary to reset its width.
  7. Open the more_vert menu in a supported column heading to:
    1. Select ‘Sort ascending’ or ‘Sort descending’. Select the active direction again to remove the sort.
    2. Select ‘Pin column’ or ‘Unpin column’.
    3. Select ‘Export column CSV’ to download the values currently included by the table's search and sort.
    4. Select ‘Hide column’ to remove the column from the current view.

Column visibility, widths, sorting, and supported pinned-column choices are retained separately for each stage on the mapping template. They can affect later imports that use the same template.

When an import contains a small number of Product Codes, the codes are colour-highlighted consistently to make groups easier to distinguish.

Was this page helpful?

© 2026 Compound Direct. All rights reserved.