on 09-27-2016 5:51 PM
HI Experts,
I want to convert Source CSV data into XML output using SAP Data service. I have followed standard approach in Data services but its generated Standard XML output.
But I want to build custom XML output format to read CSV row data into separate Nodes and this XML file has to be in batch output file for every 100 records and has to split the XML files.
Sample Input CSV file:
Column1 Column2 Column3 column4 column5
EMP_no Dept Position Emp_name location
1000 HR Staff Emp_name location
1001 HR HR Mgr Emp_name location
.
.
.
.
.
.
.
1000 Rows of records.
Sample Output XML format for every 100 records.
<?xml version="1.0" encoding="utf-8"?>
<root>
<node type ="doc" action="create">
<location>C:\Output_files</location>
<title>"Emp_number in column 1"</title>
<file>"Name in Column 2"</file>
<versioncontrol>TRUE</versioncontrol>
<mime>application/pdf</mime>
<category name=" Emp_Name">
<attribute name="Emp_No">Value from CSV rows</attribute>
<attribute name="Dept">value from CSV rows</attribute>
<attribute name="Position">Value from Column 3</attribute>
<subitems>reapply</subitems>
</category>
</node>
<node type = "Doc" action="Create'>
.
.
.
This format has to built for every 100 set of rows and store the output files in separate record.
Can I use Python script using "USER_Defined" Transform Function for XML output with desire format? Please advise with sample code.
Thanks in advance.
No need for User_defined transform.
Load your .csv into a table, number your records (row_num_gen). Build a data flow that reads 100 records from the table and produces the .xml file. Loop over the data flow until all records processed.
Use global variables for specifying extraction windows in the table and the names of the output files.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.