Distribution import wizards
The Distribution Tools menu has three wizards that import distribution data from a text file: import customers sales channels, import ordered materials, and import distribution routes. The three wizards have the same five pages. They differ in the list of fields you choose from and in what they do with each line of the file. This page explains the shared pages, then the file format and the rules of each import.
Opening the wizards
From the ribbon: Distribution > Tools > Distribution Tools, then choose one of the three commands. Your licence must include the distribution feature, and you need the permission of the command in Users Management, on the Reports page. The permission is a single check box with the same name as the command.
| Command | Import | Practical steps |
|---|---|---|
| Import Customers Sale Channels | Gives each customer a sales channel, a type, contract data, a status and a warehouse. | Import customers sales channels |
| Import Ordered Materials | Defines the ordered materials by customer classification, materials template, customer type and sales channel. | Import ordered materials |
| Import Distribution Routes | Gives the customers of a distribution unit their visit numbers and times. | Import distribution routes |
The title of the wizard window is the name of the import. The texts of some pages change with the import, as shown below.
Wizard buttons
| Button | What it does |
|---|---|
| Next | Checks the current page and moves to the next one. If the check fails, the wizard stays on the page and a message appears. Disabled on the last page. |
| Back | Returns to the previous page without a check. Disabled on the first page. |
| Start | On the last page only. It checks the fields, asks for confirmation, then starts the import. See Starting the import. |
| Cancel | Asks: "Are you sure to abort?". Click Yes to close the wizard without importing, or No to stay. |
The wizard keeps the file path, the separator and the update option while you move between its pages, but it does not keep them from one run to the next: every run starts with an empty path, the tab as separator, and the update option ticked. If you leave the File Fields page and come back, the program forgets the fields you chose for the columns and puts Start line back to 1.
Page 1: Welcome
It has no fields. The heading and the first two texts change with the import. The third text is fixed.
| Import | Heading | What the page explains |
|---|---|---|
| Customers sales channels | Import Customers Sale Channels | That the wizard guides you to import customers' sales channels from a text file, and that the file may come from alameen or another program and hold customer names and codes, warehouses, customer types and sales channels. |
| Ordered materials | Import Ordered Materials | That the wizard guides you to import ordered materials from a text file that holds material names and codes, customer types and classifications, and sales channels. |
| Distribution routes | Import Distribution Routes | That the wizard guides you to import distribution routes from a text file that holds the names and codes of distribution units and customers. |
The third text explains the Next, Back and Cancel buttons.
Page 2: File name
The page heading is Select File. Its text asks for the name of the text file that holds the customers' sales channels, the ordered materials list or the distribution routes data, depending on the import.
| Field | Description | Required | Values and rules |
|---|---|---|---|
| Path box | The path of the text file. | Yes | Example: D:\data\routes.txt. The path stays in the box if you come back to the page in the same wizard. It starts empty in every run. |
| Preview... | Opens a file chooser with the filter *.txt files. | — | Puts the chosen path in the box. |
When you click Next, the program checks:
- The path is empty: a callout next to the field appears with the title "Error" and the text "Empty Field".
- The program cannot open the file for reading: "An error encountered while opening the file" appears with the path under it. This happens if the file does not exist, or if another program holds it open for writing.
Page 3: Fields separator
The page heading is Fields Separator. It explains that the fields of the text file are separated by a tab, a comma or something similar, and that you must specify the separator.
| Option | Description | Values and rules |
|---|---|---|
| Tab | The columns are separated by the tab character. | The default choice. |
| Comma | The columns are separated by a comma ,. | — |
| Semicolon | The columns are separated by a semicolon ;. | — |
| Other | The columns are separated by another character. | Type the character in the box next to it. The program uses the first character only. If you choose Other and leave the box empty, the message "You must specify field separator" appears. |
The program splits each line at the separator, character by character. It does not recognize quotation marks, so a separator inside a value splits that value too.
Page 4: Update data
The page heading is File Fields, whatever the import. It has an explanation text and one option, and both change with the import.
| Import | Option | Default |
|---|---|---|
| Customers sales channels | Update Existing Customers' Sales Channels | Ticked |
| Ordered materials | Update Existing Ordered Materials | Ticked |
| Distribution routes | Update Existing Distribution Routes | Ticked |
The text explains that the program does not add again a line that already exists in the database, and that ticking the option makes it update the existing one. What "existing" means, and what is updated, differ for each import, and are explained in What each import does. If you clear the option, every line that already exists fails, and the program counts it among the records it could not import.
Page 5: File fields
The page heading is File Fields. It asks you to specify the fields of the file contents and the line to start from. Under it a note says "Accounts will have same customers' names." None of the three imports creates accounts, so the note does not apply to them.
| Item | Description | Required | Values and rules |
|---|---|---|---|
| Start line | The number of the first line of the file to import. | Yes | 1 or more. It starts at 1 every time the page appears. Type 2 to skip a header line. If you type zero, the message "The "Start Line" must be more than 1" appears, although 1 is accepted. The program reloads the file in the grid whenever you change it. |
| Fields grid | The first row holds a list for each column, in which you choose the field that the column carries. Below it are the lines of the file, split by the separator. The first row header is Fields, the column headers are "Column 1" and so on, and the line headers are 1 and so on, counted from the start line. | — | Every list starts on without. The grid shows about 10000 lines of the file, and the import reads the whole file. |
| Progress bar | Moves during the import. | — | — |
Buttons: Start, Back and Cancel. Next is disabled on this page.
The number of grid columns equals the number of entries in the field list: 12 for sales channels, 12 for ordered materials and 25 for routes. But when it imports, the program reads only the first 11 columns of the file for sales channels and ordered materials, and the first 24 columns for routes. Put the columns you need within these.
Checks of page 5
When you click Start, the program checks in order, and stops at the first check that fails:
| Check | Message |
|---|---|
The start line is less than 1 | "The "Start Line" must be more than 1" |
| You chose a field for two columns | "There are repeated fields in the table" |
Then the checks of the import:
| Import | Check | Message |
|---|---|---|
| Customers sales channels | You chose neither Customer Name nor Account Code | "Must select customer name or account code" |
| Customers sales channels | You chose both | "Must select either customer name or account code" |
| Customers sales channels | You chose Warehouse Code and Warehouse Name together | "Must select either warehouse code or name" |
| Customers sales channels | You chose none of Sales Channel, Customer Type, Customer Status and Contracted | "Must select sales channel, customer type, customer status, contracted, and warehouse code/name". One of the first four is enough. A warehouse alone is not enough. |
| Ordered materials | You did not choose From | "Must select "From Date" field" |
| Ordered materials | You did not choose To | "Must select "To Date" field" |
| Ordered materials | You chose neither Material Code nor Material Name | "Must select material code or name" |
| Ordered materials | You chose both | "Must select either material code or name" |
| Ordered materials | You did not choose Qty | "Must select quantity field" |
| Ordered materials | You chose none of Customer Classification, Materials Template, Customer Type and Sales Channel | "Must select customer classification, material template, customer type and sales channel". One of them is enough. |
| Distribution routes | You chose neither Customer Name nor Account Code | "Must select customer name or account code" |
| Distribution routes | You chose both | "Must select either customer name or account code" |
| Distribution routes | You chose neither Distribution Unit Code nor Distribution Unit Name | "Must select either distribution unit code or name" |
| Distribution routes | You chose both | "Must select either distribution code or name" |
If the file is empty, the message "File is empty" appears when you enter the page.
Starting the import
After the checks pass:
- The program asks: "Are you sure to start?" followed by the name of the import and "؟", with no space between them. Example: "Are you sure to start?Import Distribution Routes؟".
- If you click No, the wizard closes without importing, and it does not return to the page.
- If you click Yes, the program reads the file line by line from the start line, saves each line by the rules of the import, and the progress bar moves. Then it saves the successful lines together.
- A message appears with two counts: "Imported records:" and the number, and "Unimported records:" and the number. Then the wizard closes. The program does not show which lines failed or why.
The import skips the empty lines of the file, and counts every other line as a record, including a header line if you did not skip it with Start line. A line in which no customer is found, or whose rules are not met, counts as failed, and the import goes on.
The file format
- Encoding: Unicode text in UTF-16, which some programs call Unicode. The import reads the file two bytes at a time, so it does not read a file saved in another encoding correctly, even though the grid on page 5 may show UTF-8 files and files in the Windows default encoding correctly. If you prepare the file in Microsoft Excel, save it with the type "Unicode Text". Make sure that no value contains a tab or the separator you chose.
- Lines: one line per record. Empty lines are skipped.
- Columns: in order. On page 5 you choose the field of each column. A field can be in any column. A missing column in a line counts as empty.
- Separator: the one you chose on page 3, with no quotation marks.
- Dates: as
31-12-2026or2026-12-31, with hyphens between the parts. An empty date means "no date". - Times: as
08:30:00or08:30. A part outside its range, such as an hour above 23, becomes zero. - Numbers: whole numbers in Western digits.
An example of a sales channels file, with the columns separated by a tab and the first line holding headers:
Customer Name Sales Channel Customer Type Contracted Contract Date Contract No
Alnakheel Est. Supermarket Retail yes 01-01-2026 15
What each import does
Import distribution routes
| Field | Description | Required | Values and rules |
|---|---|---|---|
| Distribution Unit Code | The code of the distribution unit. | It or the name | The program looks for a unit whose code or name equals the value. |
| Distribution Unit Name | The name of the distribution unit. | It or the code | You cannot choose both. |
| Account Code | The code of the customer's account. | It or the customer name | You cannot choose both. |
| Customer Name | The customer name in the customer card. | It or the account code | The program looks for a customer whose name or account equals the value. If more than one customer matches, it takes the last one. |
| Visit 1 to Visit 10 | The visit day number. | No | A whole number from 1 to the Coverage Days Count, saved in the coverage options. Anything else, including 0 and empty, is saved as 0. If the Coverage Days Count was never saved in the file, every visit becomes 0. |
| Visit 1 Time to Visit 10 Time | The visit time. | No | 08:30:00. Empty is 00:00:00. |
A line fails, and the program counts it as not imported, in these cases: the line has no customer name and no account code, or no unit; no customer has this name or account; no unit has this code or name; the unit belongs to a replication source other than the one of this file; or the route already exists and you did not tick the update option.
- New route (the customer has no route in the unit): the program creates it with the visits and times in the file. Those you did not choose are saved as
0and00:00:00. The route is saved even if all its visits are0. The program also adds the customer to the sub-accounts of the unit's customers account, if the customer is not already there. - Existing route with the update option ticked: the ten visits and their ten times are replaced by what is in the file. Those you did not import become
0and00:00:00.
Import ordered materials
| Field | Description | Required | Values and rules |
|---|---|---|---|
| Customer Classification | The classification of the customers who need the material. | One of four | Matched by the classification name. |
| From | The start of the order period. | Yes | A date. |
| To | The end of the period. | Yes | A date. |
| Material Code | The material code. | It or the name | Matched by the material code. |
| Material Name | The material name. | It or the code | You cannot choose both. |
| Qty | The ordered quantity. | Yes | A whole number: fractions are cut, so a quantity of 0.5 becomes 0 and the line fails. A quantity of 0 rejects the line. |
| Unit | The material's unit. | No | The name of the first, second or third unit as in the material card. Any other value, including empty and numbers, counts as the first unit. |
| Material Type | Whether the material is optional. | No | 0 or empty: obligatory. Any other number, such as 1: optional. |
| Materials Template | The materials template. | One of four | Matched by the template name. |
| Customer Type | The customers type. | One of four | Matched by the type code or name. |
| Sales Channel | The sales channel. | One of four | Matched by the channel code or name. |
- The group: the ordered materials are defined in a group that is the combination of the classification, the template, the type, the channel and the start and end dates. The import creates the group if it does not exist, and adds the material to it.
- A line fails if none of the classification, template, type and channel is matched in the database, or the material is not found, or the quantity is
0, or the material is already in the same group and you did not tick the update option. If one of them is matched and another is not, the group is created with the matched one only and the other is left empty without a warning. - A material already in the group with the update option ticked: the quantity, the unit and the type are replaced.
- A material not in an existing group: it is added to it, whether or not you ticked the update option.
- The program stores the quantity multiplied by the factor of the chosen unit, that is, in the first unit.
Import customers sales channels
| Field | Description | Required | Values and rules |
|---|---|---|---|
| Customer Name | The customer name. | It or the account code | The program looks for a customer whose name or account equals the value. |
| Account Code | The code of the customer's account. | It or the customer name | You cannot choose both. |
| Sales Channel | The channel. | In practice yes | Matched by the channel code or name. The line fails if no channel matches, or the field is empty or not chosen. |
| Customer Type | The type. | No | Matched by the type code or name. If it is not empty and no type matches, the line fails. |
| Customer Status | Whether the customer is active. | No | 0, or text that is not a number: Inactive. Any other number, or the column not chosen: Active. |
| Contracted | Whether the customer is contracted. | No | The values 1, متعاقد, Contracted, نعم and yes, exactly in these letters: contracted. Any other value, even Yes and لا, or the column not chosen: not contracted. |
| Contract Date | The contract date. | No | A date. If you did not choose the column, the date of the import day is saved, even for a customer who is not contracted. |
| Contract No | The contract number. | No | A number. The database converts it to a number, so the line fails if it is not a number. A column not chosen gives 0. |
| Notes | Notes. | No | Text. |
| Warehouse Code | The transposition warehouse. | No | Matched by the warehouse code. If the warehouse is not found, the line does not fail, and the transposition warehouse stays empty. |
| Warehouse Name | The transposition warehouse. | No | Matched by the warehouse name, as for Warehouse Code. You cannot choose both. |
- A customer with no record: a record is created for the customer with a new number.
- A customer with a record and the update option ticked: everything in it is replaced by what is in the file. The channel, type or warehouse that you did not choose in the file are emptied. The customer becomes Active, not contracted, with contract number
0and a contract date of the import day. Choose in the file everything you want to keep. - If the update option is not ticked, every line for a customer who has a record fails.
- The two counts in the final message count each customer name once. If you chose Account Code instead of Customer Name, the name is empty for every line, so each count is
1or0.
Messages
| Message | Why it appears | What to do |
|---|---|---|
| "Are you sure to abort?" | You clicked Cancel. | Yes closes the wizard, No keeps it. |
| "Empty Field" | You did not type the file path. | Type the path or click Preview.... |
| "An error encountered while opening the file" + path | The file cannot be opened: it does not exist, or another program holds it open for writing. | Correct the path, and close the file in the other program. |
| "You must specify field separator" | You chose Other and did not type the character. | Type the separator. |
| "File is empty" | The file size is zero. | Choose a file that has data. |
| "The "Start Line" must be more than 1" | The start line is less than 1. | Type 1 or more. |
| "There are repeated fields in the table" | You chose the same field for two columns. | Choose without for one of the columns. |
| "Must select ..." messages | A field is missing, or you chose two fields that cannot go together. | See Checks of page 5. |
| "Are you sure to start?" + the import name + "؟" | You clicked Start and the checks passed. | Yes to start. No closes the wizard without importing. |
| "Imported records:" and "Unimported records:" + two counts | The import has finished. | Check the counts, then check the data in the windows. The failed lines are not listed. |
Related
This page applies to alameen ERP 10, version 10.1.79.764.