Difference between revisions of "Creating New Data Import Window"

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.
(Created page with '{{Note|It is helpful to give the Import Loader Format a name similar to the import data file. A leading number in the name can help keep the order of imports straight. For exampl…')
 
Line 1: Line 1:
{{Note|It is helpful to give the Import Loader Format a name similar to the import data file. A leading number in the name can help keep the order of imports straight. For example, the csv file is called "0 - Opening Trial Balance.csv" and the Import Loader Format name is set to "0 - Opening Trial Balance". This makes it easy to deal with lots in import files and their associated formats.}}
+
<span style="color:red;"><b>This page is under construction</b></span> --[[User:Kittiu|Kittiu]] 04:42, 12 October 2010 (UTC)
 +
 
 +
==Overview==
 +
In ADempeire, there is a great way of importing data into the system using the existing Data Import module. You can read about how the Data Import works from [[Data Import]]. The great thing is that, we can always do validation to our data before the data transfer really take place.
 +
 
 +
''"The data import process has two main steps. Data is read into the system and placed in a temporary table. From there it is processed and entered into the main database. The two step process helps prevent errors in the data from affecting the main database. The first step of importing the data requires a definition of the data file that will be imported and information about where to put it in the temporary tables. This is performed by an Import File Loader and an Import Loader Format."''
 +
 
 +
The only shortcoming is that, the Data Import Window available for standard version only cover some of the main data, i.e., Product, BPartner, etc. and not all data we want to import can be imported. In many case, we will want to customize our own data validation and more fields to import. This page will give the steps by steps on how to create a new Data Import Window.
 +
 
 +
==Scenario==
 +
Just to make a short example, we will be creating a new Import Attribute and Import Attribute Value. To make it simple, the fields available will be pretty much matching with the data fields on the window.
 +
 
 +
[[File:Import Attribute.jpg]]
 +
[[File:Import Attribute Value.jpg]]
 +
==Steps by Steps==
 +
1. Table Tab window, Copy columns from M_Attribute
 +
2. Add 4 new column import
 +
=> I_ErrorMsg, I_IsImported, Processing, Processed
 +
=> M_Attribute_ID, (M_AttributeValue_ID, AttributeName)
 +
=> + Any field we want to lookup, i.e., Attribute Name, etc.
 +
3. Sync column to create database table
 +
3.1 Make sure that I_IsImported do not have constraint Y/N (drop and recreate table)
 +
4. Create Model classes
 +
    I_I_Attribute
 +
X_I_Attribute
 +
5. Create Process Class and in window Report & Process create process and parameter
 +
5.1 register process to Table's Button
 +
6. Create window, re arrange as proper.
 +
7. Register to menu
 +
8. In Table window, link to this new Window
 +
9. Packout
 +
 
 +
Note:
 +
For Child Table
 +
- In Column, mark M_Attribute_ID as parent link column
 +
- In Tab, Set tab level to be 0, 1
 +
More Note:
 +
- Tab level can't be used in Import Table
 +
- All table must have ID
 +
- For I_Tables, make sure it is not null. Otherwise, it will has problem when import. Or has default value (only I_xxx_ID and isimported should be mandatory)
 +
 
 +
SQL to drop constraint
 +
ALTER TABLE adempiere.i_attribute
 +
  DROP CONSTRAINT i_attribute_i_isimported_check;
 +
 
 +
ALTER TABLE adempiere.i_attributeset
 +
  DROP CONSTRAINT i_attributeset_i_isimported_check;
 +
 
 +
ALTER TABLE adempiere.i_attributeuse
 +
  DROP CONSTRAINT i_attributeuse_i_isimported_check;
 +
 
 +
ALTER TABLE adempiere.i_attributevalue
 +
  DROP CONSTRAINT i_attributevalue_i_isimported_check;
 +
 
 +
ALTER TABLE adempiere.i_attributesetinstance
 +
  DROP CONSTRAINT i_attributesetinstance_i_isimported_check;
 +
 
 +
 
 +
Next action
 +
1. Test Packin - OK
 +
    - Table need to manually drop and create table - Can we use SQL in packin?
 +
    - Permission for Process is not carried over, need to check.
 +
2. Import Attribute Value --> Make it same window
 +
3. Import Attribute Set, Attribute Set Instances
 +
 
 +
Testing
 +
1. In all window, when copy, the Imported is still checked. -- OK like others.
 +
2. About Instance Attribute flag in Attribute Set window - OK
 +
 
 +
{{Note|
 +
XXX
 +
}}

Revision as of 20:42, 11 October 2010

This page is under construction --Kittiu 04:42, 12 October 2010 (UTC)

Overview

In ADempeire, there is a great way of importing data into the system using the existing Data Import module. You can read about how the Data Import works from Data Import. The great thing is that, we can always do validation to our data before the data transfer really take place.

"The data import process has two main steps. Data is read into the system and placed in a temporary table. From there it is processed and entered into the main database. The two step process helps prevent errors in the data from affecting the main database. The first step of importing the data requires a definition of the data file that will be imported and information about where to put it in the temporary tables. This is performed by an Import File Loader and an Import Loader Format."

The only shortcoming is that, the Data Import Window available for standard version only cover some of the main data, i.e., Product, BPartner, etc. and not all data we want to import can be imported. In many case, we will want to customize our own data validation and more fields to import. This page will give the steps by steps on how to create a new Data Import Window.

Scenario

Just to make a short example, we will be creating a new Import Attribute and Import Attribute Value. To make it simple, the fields available will be pretty much matching with the data fields on the window.

Import Attribute.jpg Import Attribute Value.jpg

Steps by Steps

1. Table Tab window, Copy columns from M_Attribute 2. Add 4 new column import => I_ErrorMsg, I_IsImported, Processing, Processed => M_Attribute_ID, (M_AttributeValue_ID, AttributeName) => + Any field we want to lookup, i.e., Attribute Name, etc. 3. Sync column to create database table 3.1 Make sure that I_IsImported do not have constraint Y/N (drop and recreate table) 4. Create Model classes

   I_I_Attribute

X_I_Attribute 5. Create Process Class and in window Report & Process create process and parameter 5.1 register process to Table's Button 6. Create window, re arrange as proper. 7. Register to menu 8. In Table window, link to this new Window 9. Packout

Note: For Child Table - In Column, mark M_Attribute_ID as parent link column - In Tab, Set tab level to be 0, 1 More Note: - Tab level can't be used in Import Table - All table must have ID - For I_Tables, make sure it is not null. Otherwise, it will has problem when import. Or has default value (only I_xxx_ID and isimported should be mandatory)

SQL to drop constraint ALTER TABLE adempiere.i_attribute

 DROP CONSTRAINT i_attribute_i_isimported_check;

ALTER TABLE adempiere.i_attributeset

 DROP CONSTRAINT i_attributeset_i_isimported_check;

ALTER TABLE adempiere.i_attributeuse

 DROP CONSTRAINT i_attributeuse_i_isimported_check;

ALTER TABLE adempiere.i_attributevalue

 DROP CONSTRAINT i_attributevalue_i_isimported_check;

ALTER TABLE adempiere.i_attributesetinstance

 DROP CONSTRAINT i_attributesetinstance_i_isimported_check;


Next action 1. Test Packin - OK

   - Table need to manually drop and create table - Can we use SQL in packin?
   - Permission for Process is not carried over, need to check.

2. Import Attribute Value --> Make it same window 3. Import Attribute Set, Attribute Set Instances

Testing 1. In all window, when copy, the Imported is still checked. -- OK like others. 2. About Instance Attribute flag in Attribute Set window - OK


Note.gif Note:

XXX