Mapping Templates
Turn external spreadsheet columns into consistent, reusable bulk imports.
Mapping Templates in Compound Direct define how the columns in a CSV 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 CSV file or by selecting mapped fields.
- Configure source columns, default values, required fields, and mapping rules.
- 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.
Finding a mapping template
- Go to the āSettingsā page.
- Click on āTemplatesā.
- Select āMapping Templatesā.
- You can also go to āBulk Importsā and click āManage Templatesā on the āBulk Import Dashboardā.
- The āMapping Templatesā page displays each template's Name and Description, Template Type, Date Created, and Last Used date.
- Begin typing the
template namein the search search bar to refine the list. - Click the desired āMapping Templateā to view or edit it.
Planning a mapping template
Before creating a template, identify which columns your source system provides and which Compound Direct fields they should populate.
- Use one row in the CSV file for each draft you intend to create.
- Keep the source column headings consistent between files. A saved Source column should match the corresponding CSV heading.
- Include enough information to identify the required
customerandproductfor every active row. - Add prescription, prescriber, delivery, account, or order fields only when they are needed for your workflow.
- Decide which values are supplied by the CSV and which should be supplied by a template Default Value.
- Decide which fields must be completed before drafts can be created, then mark those mappings as Required.
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.
Creating a mapping template
- Go to the āMapping Templatesā page.
- Click āCreate Templateā.
- Enter a clear
Template Name. - Enter a
Descriptionthat identifies the source system, file type, or intended workflow. - Build the āColumn Mappingā in either of the following ways:
- To scan an existing layout, upload or drag and drop one .csv file into āUpload import file to be scannedā.
- Compound Direct reads the first row as the source column headings.
- Where a heading resembles an available Compound Direct field name, the corresponding Mapped field is selected automatically.
- Review every automatically selected field before saving.
- To build the template manually, click āAdd Mapped Fieldā or āAdd Mapped Fieldsā.
- Search for a field or expand a category.
- Tick each field you want the template to support.
- Click āDoneā.
- To scan an existing layout, upload or drag and drop one .csv file into āUpload import file to be scannedā.
- Configure each row in āColumn Mappingā:
- In āSource columnā, enter the heading used in the CSV file.
- In āDefault Valueā, optionally enter a value to use when the source value is blank or the source column is not supplied.
- Tick āRequiredā when the mapped value must be present before the item can proceed.
- Under āMapped fieldā, select the Compound Direct field that receives the value.
- Drag the reorder icon to arrange the mappings in a practical review order.
- To remove a mapping, click the delete_outline icon beside it.
- Add any required Mapping Rules.
- Click āCreate Templateā.
Each source column shown in the mapping table must have a Mapped field, and each mapped field can only be used once. Remove any source columns you do not want to import.
Understanding column mapping
Each mapping row controls how one value is prepared for the import.
| Setting | How to use it |
|---|---|
| Source column | Enter the CSV heading that contains the value. Keep the spelling and spacing consistent with the source file. |
| Default Value | Enter 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. |
| Required | Tick this when an empty value should be treated as an issue that must be resolved before draft creation. |
| Mapped field | Select 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
- Enter dates in your workspace date format or as YYYY-MM-DD.
- For a Yes/No field, use TRUE, YES, Y, or 1 for Yes. Other or blank values are treated as No.
- Separate multiple tags with commas in fields such as Tags, Customer Tags, or Order Tags.
- Enter percentages as numbers between 0 and 100 where a percentage field is used.
- Enter currency and quantities as numbers without explanatory text.
Mapped fields that affect later processing
| Field | User-facing effect |
|---|---|
| Customer ID / Prescriber ID | Uses 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 Name | Provides the product search term used during reconciliation. Always verify the selected product before creating drafts. |
| Product Code | Supplies 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 Name | Selects a named drug multipack or formulation price when that name is available. |
| Repeat On File | Attempts to create the draft from an eligible existing repeat for the same customer and product. |
| Barcode | Imports one supported e-prescription item. A barcode cannot be reused by another row in the same import. |
| E-Script Repeat Email | Sets the email address that should receive the repeat token. |
| Purchase Order No | Groups rows with the same purchase order number into one order, unless grouping by customer is enabled. |
| Group Order By Customer | Groups all eligible rows for the same matched customer into one order. |
| Order Workflow | Applies the named order workflow. Use the exact workflow name where possible. |
| Discount Percentage / Discount Amount | Applies one form of discount. Do not provide both for the same row. |
| Discount Applied To Item | Applies the discount to the line item instead of the whole order. |
| Item Is Archived | Archives the row during reconciliation so it does not create a draft. |
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.
Adding mapping rules
Mapping Rules conditionally change or validate row values. Use them when the same source layout needs different outcomes depending on the contents of a row.
- Create or open a mapping template.
- Under āMapping Rulesā, click āAdd Ruleā.
- Enter an optional
Rule nameso the rule's purpose is easy to recognise. - Leave āRule enabledā switched on for the rule to run during imports.
- Under āWhenā, configure the condition:
- Select whether to inspect a Source column or a Mapped field.
- Select or enter the column or field.
- Choose a comparison, such as equals, does not equal, contains, starts with, ends with, a greater/less than comparison, is empty, or is not empty.
- Enter the
Comparison valuewhen required.
- To use more than one condition, click āAdd Conditionā and select whether all conditions are true (AND) or any condition is true (OR).
- Under āThenā, configure one or more actions. A rule can:
- Set a mapped field to a value.
- Copy from a source column or another mapped field.
- Append, prepend, remove, or replace text.
- Add, subtract, multiply, or divide a number.
- Clear a mapped field.
- Add an issue to the whole row or to a related field with a user-readable message.
- If needed, tick āDo not run this rule when these conditions are trueā and configure the exception conditions.
- Tick āStop processing later rules when this rule matchesā if no later rule should change the row after this rule succeeds.
- Click āSave Ruleā.
- Review the When and Then summary shown on the rule card.
- Drag the drag_indicator icon to change the order in which rules are applied.
- Click āDuplicateā, āEditā, or āRemoveā to manage an existing rule.
- Click āSave Templateā when finished.
Rules run in the order shown. A later rule can use or change a value produced by an earlier rule unless āStop processing later rulesā is enabled.
If a rule refers to a source column that is not directly mapped, make sure that heading is present in the CSV file. āGet Templateā only guarantees the inclusion of directly mapped source columns.
Using the JSON rule editor
The Visual / JSON toggle provides an advanced editor for specialised rules.
- Click the āVisual / JSONā toggle to view the rule as JSON.
- Only edit the JSON if you understand the rule format used by your workspace.
- Resolve any validation message before clicking āSave Ruleā.
- Toggle back to āVisualā when the rule can be represented by the visual editor.
Some advanced JSON expressions cannot be represented by the visual editor. In that case, continue editing the rule in JSON or simplify the rule.
Testing and downloading a mapping template
- Save the mapping template.
- Click āGet Template file_downloadā to download a blank CSV containing its source headings.
- Open the file and confirm that the headings match the export produced by your source system.
- Add a small set of representative rows, including any unusual customer, product, order, or prescription scenarios.
- Start a test import and review the āUploadedā and āDraftingā stages before creating drafts.
- 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.
Starting an import from a mapping template
- Open a saved, unarchived mapping template.
- Ensure there are no unsaved changes.
- Click āStart Importā.
- In the āNew Importā modal, either:
- Upload or drag and drop a completed .csv file; or
- Click āCreate Without CSVā to add rows manually.
- Continue with the Starting a bulk import guide.
Editing and managing mapping templates
- Go to the āMapping Templatesā page.
- Select the desired template.
- Update the
Template Name,Description, column mappings, defaults, required fields, or mapping rules. - Click āSave Templateā.
To duplicate a mapping template:
- Open the mapping template.
- Click the āMore actionsā menu.
- Select āDuplicate Templateā.
- Update the duplicate's name or settings, then click āSave Templateā.
To archive or unarchive a mapping template:
- Open the mapping template.
- Click the āMore actionsā menu.
- Select āArchiveā or āUnarchiveā.
Archived templates cannot be selected for a new import until they are unarchived.
Customising import columns with a mapping template
The table layout used during an import is saved with its mapping template, helping repeated imports use a consistent review layout.
- During an import, open the āUploadedā, āDraftingā, āQueuedā, or āDispensedā tab.
- Click āColumnsā.
- Tick the fields you want displayed and untick fields you want hidden.
- Click āDoneā.
- Drag a column boundary to resize it, or double-click the boundary to reset its width.
- Click the push_pin icon in a column heading to pin or unpin the column where available.
Column visibility, widths, and supported pinned-column choices are retained on the mapping template and can affect later imports that use it.