Check File Structure and Update Default Fields Structure
This page explains two wizards of Files Maintenance in alameen ERP 10. The first, Check File Structure, compares the structure of the tables of the open file with the standard structure the program uses, and lists the differences without changing anything. The second, Update Default Fields Structure, refreshes the definitions of the default tables (Views) in the database when there is a problem with them. For the working steps see Check the file structure and Update default fields structure.
Opening the wizards
- On the File tab click Tools, then Files Maintenance. Select Check File Structure or Update Default Fields Structure, and click Execute. Run files maintenance explains how to open the window.
- The wizards also start from the favorites menu on the Tools page, from Quick Launch search and from a Maintenance tile on the desktop.
- Both operations are in the list in single file and multiple files mode, provided your edition includes accounting (Available maintenance operations). Both are among the least dangerous operations (the warning frame shows only above low severity, and these two are at the lowest levels), so they show no warning frame, and they come first in the list after the favorites.
- The description of the first, under its name: "Compare the current file structure with the standard reference structure to ensure that columns names and order match the expected format, detect any missing or extra columns, and verify the integrity of foreign keys and other potential issues." The description of the second: "This maintenance enables you to update Default Fields Structure(Views) in case of a problem".
- You need the Files Maintenance permission (conditions). Users Management > Operations also lists a permission for each operation; the program checks it only to show or hide the desktop tile, not when you start the operation from the window, the favorites menu or Quick Launch. Neither wizard shows a backup page, and neither records itself in the maintenance log.
Check File Structure
The wizard has two pages: Choosing what to compare and Comparison result. Both are titled "Check File Structure". The Next and Back buttons and the cancel question work as described in How the maintenance wizards work.
Choosing what to compare
Under the title is an explanation paragraph: "Compare the current file structure with the standard reference structure to ensure that columns names and order match the expected format, detect any missing or extra columns, and verify the integrity of foreign keys and other potential issues."
Then the sentence "Please select the structure components you want to compare" and three check boxes, all ticked the first time the page opens. The wizard keeps your choice while the program stays open, so the next time the page opens with the boxes as you left them.
| Field | Description | Required | Values and rules |
|---|---|---|---|
| Missing Index | Compares the indexes of each table with the indexes of the standard structure. | No | Ticked when the page opens. If you clear it, indexes are not compared and the Missing Index counter does not appear on the next page. |
| Data Type Mismatch | Compares the data type of each field, and the length of text fields, with the standard structure. | No | Ticked when the page opens. Clearing it hides the Data Type Mismatch counter. |
| Missing Foreign Keys | Compares the foreign keys of each table with the standard structure. | No | Ticked when the page opens. Clearing it hides the Missing Foreign Key counter. |
Always compared, whatever you tick: the tables (missing and extra), the fields (missing and extra), the number of fields of each table, and the order of the fields.
| Button | What it does |
|---|---|
| Next | Keeps your choice and goes to the result page. |
| Back | Disabled: this is the first page. |
| Cancel | Asks "Are you sure you want to exit and cancel the maintenance operation?". |
Comparison result
The page has the error list at the top, the progress bar under it, then seven blue counters, then the buttons. The list is empty and every counter shows 0 until you click Start.
| Item | What it shows |
|---|---|
| Error list | A row for each difference, with five columns: Element, Type, Error Message, Error Type and Error Number. Click a column heading to sort the list by it. The columns are explained in Error types. |
| Missing Table | The number of tables missing from the file and extra tables in it. |
| Missing Column | The number of fields missing from the file and extra fields in it. |
| Column Count Difference | The number of tables whose field count differs from the standard structure. |
| Column Order Difference | The number of tables in which a field was found out of place. |
| Missing Index | The number of missing and extra indexes. Shown if you ticked Missing Index. |
| Data Type Mismatch | The number of fields whose type or length differs. Shown if you ticked Data Type Mismatch. |
| Missing Foreign Key | The number of missing and extra foreign keys. Shown if you ticked Missing Foreign Keys. |
| Button | What it does |
|---|---|
| Start | Reads the structure of the tables of the file and compares it with the standard structure, then fills the list and the counters. It asks no confirmation and changes nothing in the file. You can click it again, and each time the previous result is cleared. |
| Back | Returns to Choosing what to compare. |
| Export | Saves the errors to a CSV file. Disabled until the list holds at least one error. |
| Close | Asks "Are you sure you want to exit and cancel the maintenance operation?", then closes the wizard. It is the button called Cancel in the other wizards. It stays enabled while a comparison runs. If you answer Yes during a comparison, the program disables the button and the comparison goes on to its end; it does not stop it and the wizard does not close. |
| Next | Disabled: this is the last page. |
When the comparison ends, the message "Operation successfully completed" appears and the wizard stays open with the result, whether differences were found or not. The message means the comparison finished, not that the structure is sound.
How the comparison works
The program reads the tables, their fields, foreign keys and indexes from the file and compares them with the standard table definitions of the program, in this order:
- For each table in the file:
- If it is not in the standard structure, Extra Table is recorded.
- If its field count differs from the standard count, Column Count Difference is recorded and no other check runs on it.
- Otherwise the program compares its fields one by one in order, and stops at the first difference. If a field name differs from the standard name at the same position: a field that is not in the standard table is recorded as Extra Column, and one that is there at another position as Column Order Difference. If the names match and you ticked Data Type Mismatch, the field type is compared with the standard type. The program does not record every type difference, only specific cases: a decimal number, an image or an integer in the file that does not match its standard type, and a text field whose length differs from the standard length.
- If no difference was recorded for the table and you ticked Missing Foreign Keys: a foreign key in the file that matches none of the standard keys of the table is recorded as Extra Foreign Key, and only the first one is recorded.
- If no difference was recorded for the table and you ticked Missing Index: an index in the file that matches none of the standard indexes of the table is recorded as Extra Index, and only the first one is recorded.
- For each table in the standard structure:
- If it is not in the file, Missing Table is recorded.
- If it is in the file and had no difference in the previous step, the program looks for its standard fields: a field that is not there is recorded as Missing Column.
- Then, if no missing field was recorded and you ticked Missing Foreign Keys: the first standard foreign key not in the file is recorded as Missing Foreign Key.
- If you ticked Missing Index: the first standard index not in the file is recorded as Missing Index.
A table with a difference in the first step is not subject to the checks of the second step, so a new difference can appear in it after you deal with the first.
Error types
| Column | Content |
|---|---|
| Element | The table name, followed by a dot and the field, key or index name when the error concerns an item inside the table, such as table_name.field_name. |
| Type | The type of the element: Table, Column, Index or Foreign Key. |
| Error Message | The description of the difference, as in the table below. |
| Error Type | The name of the difference. |
| Error Number | A fixed number for each type. |
| Error type | Error number | Error message |
|---|---|---|
| Missing Table | 100 | The table … is not found in Database |
| Missing Column | 101 | The column … is not found in Database |
| Missing Foreign Key | 103 | The foreign key … is not found in Database |
| Missing Index | 105 | The index … is not found in Database |
| Extra Table | 208 | The table … is not found in Standard Structure |
| Extra Column | 209 | The column … is not found in Standard Structure |
| Extra Foreign Key | 210 | The foreign key … is not found in Standard Structure |
| Extra Index | 212 | The index … is not found in Standard Structure |
| Column Count Difference | 302 | Database columns count is … | Standard structure columns count is … |
| Data Type Mismatch | 306 | The column … defined by data type of … in the standard structure, while the related data type in the database is … |
| Column Order Difference | 307 | The column … has an incorrect order, … instead of … |
Exporting the result
Click Export to open a save dialog with the suggested name Amn schema errors.csv and the CSV file type. If the file exists, the program asks "The file already exists on the disk, do you want to replace it?"; click Yes to continue. The program writes a UTF-8 file whose first line holds the nine column headings: Element, Table, "Field/Fields", Type, Error Message, Error Number, Error Type, Database and Standard Structure, followed by a row for each error. The Database and Standard Structure columns hold "Exists" or "Missing", the field count of each side for field count errors, and the type of each side for data type errors. When the writing ends, the message "Operation successfully completed" appears.
Update Default Fields Structure
A one-page wizard titled "Update Default Fields Structure". Its Next and Back buttons are disabled.
The page says: "This maintenance enables you to update Default Fields Structure(Views) in case of a problem", and under it: "Click 'Start' to begin the operation". Below are a status line and a progress bar that stays hidden until you click Start. There are no fields to fill in.
| Button | What it does |
|---|---|
| Start | Starts the update with no confirmation question. |
| Cancel | Closes the wizard at once without any question. It is disabled during the update. |
| Next and Back | Disabled: the page is both the first and the last. |
On Start the program performs these steps in the file, in order:
- It refreshes the definitions of the table functions.
- It refreshes the definitions of the default tables (Views).
- It registers the branch-related tables again.
- It records in the file that this update was done.
If refreshing an item fails in step 1 or 2, the program retries it up to three times, then skips it without a message and goes on. The wizard changes the definitions of the data, not the data. On success the message "Operation successfully completed" appears and the wizard closes. If the steps fail with a database error, the message "An error was encountered while performing the operation." appears and the wizard stays open.
Messages
| Message | Why it appears | What to do |
|---|---|---|
| Are you sure you want to exit and cancel the maintenance operation? | You clicked Cancel or Close in the Check File Structure wizard. | Click Yes to leave, or No to stay. |
| Operation successfully completed | The comparison, the export or the update of the default fields structure ended. | After a comparison review the list: the message does not mean the structure is sound. |
| The file already exists on the disk, do you want to replace it? | You chose an existing file in Export. | Yes replaces it, and No cancels the export. |
| Can't open file | The export file could not be opened for writing. | Choose another folder where you can write. |
| An error was encountered while performing the operation. | The update of the default fields structure failed with a database error. | Try again; if the error repeats, contact technical support. |
Related
This page applies to alameen ERP 10, version 10.1.79.764.