You can use an Excel Schema activity to define how to read data from and write data to an Excel excel file. To do so, you need to specify the name of the Excel excel sheet and enter data in the required fields, to enable identification of those fields.
While creating an Excel Schema you can also define a hierarchy (parent-child relationship) between the records. You can define a parent-child relationship only when you create the schema susing data file.
This feature is available in:
Enterprise | Premier | Professional | Express |
---|---|---|---|
√ | √ | √ | √ |
...
...
using
...
data
...
file
...
.
...
If the schema is used at the target end, and the Data Header Present checkbox is checked, the Header will be written in the target excel file.
...
Info |
---|
Name of the Headers in the data file and the Field Names in schema must be same and in same order. If they are not same, then you need to use Dynamic Header Support option. To know how to use Dynamic Header Support, refer to the Using Dynamic Header Support section. |
Info |
---|
Name of the Headers in the data file and the Field Names in schema must be same and in same order. If they are not same, then you need to use Dynamic Header Support option. To know how to use Dynamic Header Support, refer to the Using Dynamic Header Support section. |
To define the schema using definition file, select the Import Definition File radio button; select the type of file from the dropdown list File Definition and click the Upload File button to select the required file. The Schema File Upload screen is shown.
...
Now click Upload File button. Name of the uploaded file is shown in the File Name list and list of sheets of the excel file is shown.
...
Specify the Start Row No. and Start Column No. of the sheets in respective fields and then click Process Sheet(s). This will read the sheets and field names.
Info |
---|
The Start Row No. and Start Column No. fields specify the row and column from where the Adeptia Suite starts fetching the data. For example if you have an excel file in which first 4 rows of sheet1 are blank. Therefore, in that case you have to specify 5 in sheet1 Start Row No. Another scenario can be that the data is there in first 4 rows, but you do not want to fetch those records. |
...
Data Type | Description |
---|---|
String | Select this data type if the field accepts a string value. |
Number | Select this data type if the field accepts a numeric value. |
Date | Select this data type if the field accepts a Date or Date and Time value. |
Currency | Select this data type if the field accepts a currency value. |
Info |
---|
Excel Schema supports the Currency data type. |
...
If data type is Date, select the format of date and time from the dropdown lists Format and SubFormat respectively.
Info |
---|
In case you define a date format in any column of the Excel file then, please ensure that every row of that column should have the same definition of date format as in the first row otherwise the Excel schema generates an error record. |
...
- Dollar($)
- USD
- CAD
- CNY
- EUR
- GBP
- JPY
...
Info |
---|
|
Info |
---|
If you delete the last fieldname of a record and save the schema, this action will delete the entire field. For example, a record has three fields – Name, Description, and Age. If you delete Age then, the schema will delete the entire field. |
Click Advanced Properties. The following screen is displayed.
...
Dynamic Header Support check box is an advanced feature of Excel and Text Schema, which is used to parse an excel or text file, if:
FieldNames defined in the source schema and the Data Headers (Column Name) of the excel/text file are same but not in the same order.
FieldNames defined in the source schema and the Headers of the excel/text file are not same. They may or may not be in the same order.
If the headers are not matched between Schema Definition and Source File then xml (output of schema) will only have Root rather than any Record entry. For instance, if the headers of the source schema are Id, Name, and Age and the headers of the data file are Emp Id, Emp Name, and Emp Age then the output of the schema will be blank.
...
In case, the number of fields in the data file is less than the number of fields defined in schema, you need to enable the Allow Less Fields check box to process the data.
Info |
---|
|
...
- Double Quote (")
- Less than symbol (<)
- Greater than symbol (>)
...
If schema is used at source end and you want to convert the data from Encrypted Mode to Plain Text, select the secret key activity from the Decryption Secret Key dropdown list. The selected secret activity is used to decrypt the data.
Info |
---|
To know, how to create secret key activity, refer to the Creating Secret Key Activity section in the Administrator Guide. |
...
Defining Field Hierarchy
You can define hierarchy (parent-child relationship) between the records of an excel file using Define Hierarchy option of excel schema. To understand how to define hierarchy let us assume that you have an excel file which contains records of insurance policies of families.
...
As you can see in figure 238, for ID 7812 there are three policies and similarly for ID 2311 there are four policies. While defining a schema, you can specify the criteria based on which the schema can define the hierarchy. For example you can select that if the ID field is blank, merge the record in the previous record, which is having ID. Similarly, you can define the criteria for the matching record. For example if value of the ID field is matching with that of the previous record, merge the record with the previous record.
Define Hierarchy option works only when you define the schema using data file.
Steps to define hierarchy
- While creating schema, select the Import Definition File radio button and then select Data from the dropdown list.
- Click the Upload File button. The Schema File Upload screen is displayed.
- Click Browse and select the file, you want to upload. Path of the selected file is shown in the textbox Browse File.
- Now click Upload File button. Name of the uploaded file is shown in the File Name list and list of sheets of the excel file is shown (refer to Figure 248).
Specify the Start Row No. and Start Column No. of the sheets in respective fields and then click Process Sheet(s). This will read the sheets and field names.
Info The Start Row No. and Start Column No. fields specify the row and column from where the schema should start fetching data. For example, if in an excel file the first 4 rows of sheet1 are blank and you want to exclude them from your selection then, you have to specify 5 in the Start Row No. field for sheet1. Similarly, there can be some data in the first 4 rows, but you do not want to fetch those records.
- Once the processing is done, click Finish to close the Schema File Upload screen and return to create schema page.
- Once the file is uploaded the Sheet Name field is converted into the dropdown list and all the sheet names of the selected excel file are populated in this dropdown list.
- Select the sheet name from the dropdown list Sheet Name. All the fields of the selected sheet are populated.
To define the hierarchy, select the Define Hierarchy checkbox and select the merge criteria from the dropdown list Merge Criteria.
Info Currently two merge criteria are supported:
Matching Child Record: The schema merges the records in case the values in the Key fields are matching.
Blank Child Record: In case the value of the key field is blank then, the schema merges the record with a previous record whose key field is not blank.- Select the field name from the Merge Key dropdown list on basis of which record are merged.
- Click Save to save the excel schema.
Prerequisites
- Data Header must be present in the Excel/text file
- Data Type must be same in the Excel/text Schema and the excel/text file
...
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="ISO-8859-1"?>
<HeaderMap type="Name">
<Map>
<SchemaHeader>Name</SchemaHeader>
<DataFileHeader>EMP_Name</DataFileHeader>
</Map>
<Map>
<SchemaHeader>DOB</SchemaHeader>
<DataFileHeader>EMP_DOB</DataFileHeader>
</Map>
<Map>
<SchemaHeader>Age</SchemaHeader>
<DataFileHeader>EMP_Age</DataFileHeader>
</Map>
<Map>
<SchemaHeader>Address</SchemaHeader>
<DataFileHeader>EMP_Address</DataFileHeader>
</Map>
</HeaderMap> |
where:
SchemaHeader is the FieldName defined in the Excel Schema.
DataFileHeader is the name of the Header in excel file.
Excel Schema reads this XML file from process flow context. Therefore, you have to pass this XML file to the process flow context. The following figure shows a sample process flow to depict this scenario:
...
Click Edit to define the variable name and the value to be set. The Edit Context Variables screen is displayed.
...
Click the New ( ) icon. The Context Variable Information dialog box is displayed.
...
Make sure to create a stream from file source to Excel Schema activity.
...
Following are the major subsections:
Section Name | Description |
---|---|
Processing a single sheet of an excel file. | |
Processing multiple sheets of an excel file. | |
Processing unstructured file (excel and pdf). |