ASP. Aries Advanced Development Tutorial: Excel import Multi-table Advanced import configuration (middle)

Source: Internet
Author: User

Objective:

Multi-table import is a common scenario in the face of various complex import scenarios for Excel.

Just write about it today. How the multi-table import is configured.

1. Custom Import Template

How to customize:

In fact, you create a new Excel, the column headers are written well. However, there are some drop-down options, you may not be able to work, such as user roles, whether these are to become a drop-down optional operation, it is a bit troublesome to copy role data to the database.

At this point, you can tick some columns in the list, with the formatting function (generated Excel can generate the drop-down items).

Then the pilot out of the template, and then on this basis, small modifications to add some columns can be.

Here is still an example of a user table (two tables are covered in the example: Sys_user and Sys_userinfo)

Add a column, and then change the file name, and the page binding view name consistent called:V_sys_userlist.xls

(PS: This suffix is either xls or xlsx)

Then put it in the Resource\excel directory (subsequent build configuration system, the system will automatically read the Excel file in this directory).

Description

When the template is exported, if there is a custom template, then this priority (the single-table configuration of the selected export items, will not take effect because the file exists for this directory)
2. Configure advanced Excel Import.

In the Configuration table header, click "Advanced Excel Import Configuration"

Or click the menu "Excel import Configuration"

Click "Add", fill in the name of Excel, description, and this import related to the data table (multiple with "," number delimited)

The third Small icon (field mapping) after saving and clicking action

The system automatically reads the Excel file with the same name under Resource\excel\ and automatically initializes the associated data.

Next, you need to tweak the configuration a little bit: ( fix the table name and field name for Excel column names, or add other fields that need to be written to the database )

Description of the primary foreign key rule:

Primary key: The primary key is recognized automatically, so you do not need to configure the primary key. FOREIGN key: The first main table must have no foreign key, so no tube. Starting with the second table, you need to specify a foreign key (that is, the associated field, if none is required) according to this logic (n tables are also set)

So, the key to the configuration here is to sort out the associated fields of the various tables (especially when importing, involving 789 tables)

After the configuration, in fact, the operation process is unchanged, is still exported template, fill in the data, import

Summarize:

This advanced configuration can be enabled when an import requires more than one table to be involved.

For single-table, complex situations, this configuration can also be used.

Next, will be for this configuration, a more detailed introduction.

ASP. Aries Advanced Development Tutorial: Excel import Multi-table Advanced import configuration (middle)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.