Objective:
The previous two articles are general introduction of the process, there are some configuration details, not detailed, here with an article to fill.
1. Excel Configuration Items
Start row index, column header cross-line number:
For custom Excel Import templates (sometimes the template is provided by the customer, the rules of the template are messy) such as the template is preceded by some instructions, the middle is a column header, and the following data and description format. You can resolve this problem by configuring the Start row index and the column header across rows (0 or 1 for each row).
Conditional mode:
This option is for the mapping field: The case of multiple "unique keys" is checked. In some cases, a and B are required to meet a combination of conditions: A field +b word Caicai make up a unique.
In some cases, a or B may be required to combine conditions: a field or B field is unique alone.
How to import:
Insert only: Handles inserts only. Update only: Process updates only. Insert or UPDATE: The presence is updated, the insertion does not exist. All the way is: according to the unique key to check the conditions as the detection conditions.
2. Field mapping configuration
Excel Column Name:
The system automatically reads the Excel template and reads the column header name of the Excel template according to the rules.
Table name + field Name:
The system automatically reads the field description of the database and the table header configuration rules for the list, automatically matching the corresponding table name + field name. Manual adjustments are required for systems that cannot automatically identify or match errors. For relationships between multiple tables, the phone is added with a Foreign key field (the Foreign key column name can be arbitrarily taken)
Required Fields:
Specifies whether the field requires a required fill.
Only:
As a condition for detecting inserts or updates. You can check multiple, default is and combination, (in Excel import configuration there, you can specify whether and or or combination).
FOREIGN key + foreign key corresponding table name:
When more than one table is involved, there is always an associated field, so it is necessary to add the associated field, where the foreign key is added to the foreign key, it is necessary to specify which table the foreign key is associated with (the system automatically recognizes and associates the table's primary key)
PS: If the association between tables is not associated with a primary key, but is associated with a key, then the table name can be added. Field name ( this feature, which is added after this article, is not supported before the article date ).
3. Format the field map:
As with configuration rules for configuring headers, you can configure some formatting (the system will automatically recognize and automatically read it).
Rule one: #号配置 (same as import configuration rule formatting)
#是否
After the configuration, the Excel data is filled with a dropdown select Yes or no, the import data will be formatted into a database of 1 or 0.
Rule number two: @ Configuration
The following are fixed replacement values for the system:
@UserID: The current User ID.
@UserName: The current user name.
@FullName: The current real name.
Other customizations:
@XXX: The system automatically looks for a replacement with the same name from the post parameters (via reques["XXX").
Rule three:. Number configuration
You can specify a value for a field: The Configuration rule is: Table name. field name (table name can be omitted)
. FullName
Example: When a user imports, the user's name corresponds to: FullName, but the database also has a field called realname, that is, a value needs to save two copies.
Then: Add a realname field and configure the format. FullName
Rule four: Default value
System-Fixed default values:
Now (): Represents the current time.
NEWID (): a random GUID value.
Other:
9527: Write what is the value value.
Summarize:
Configuration is the core, understanding the basic can handle most of the situation, without writing code.
If you really want to write, take a look at the next article.
ASP. Aries Advanced Development Tutorial: Description of the Rules for Excel import configuration (bottom)