on 08-24-2015 5:37 AM
Hi Experts,
My scenario is flat file to file xml.
Below are source and target formats. field separator and end separator are new line.
Source:
one
two
three
Target:
<Row>
<Fieldone>one</Fieldone>
<Fieldone>two</Fieldone>
<Fieldone>three</Fieldone>
</Row>
I heard that, we can not use field separator as 'nl'. Is it true? if so is it mandatory to use java mapping for this requirement?
Please assist me on Java mapping in that case.
Appreciate your help on this.
Hi All, Thanks for your inputs.
I got confused by below thread.
http://scn.sap.com/thread/3446054
My original source structure has almost 35 fields each are separated by new line.
Example:
1
0.0
Original
12345
US
.
.
.
etc till 35th field.
So I created structure as
<MT_test>
<row>(0..to..unbounded)
<field1>(0..to 1)
.
.
.
.
etc till <field 35>(0..to 1)
</row>
And maintained FCC parameters as below.
Error before field separator:
Conversion initialization failed: java.lang.Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found: Parameter 'row.fieldFixedLengths' or 'row.fieldSeparator' is missing Consistency check: no. of arguments in 'row.fieldFixedLength' does not match 'row.fieldNames' (0 <> 37)
Result after field separator which is not expected:
<row>
<fieldone>1</fieldone>
</row>
<row>
<fieldone>0.0</fieldone>
</row>
<row>
<fieldone>Original</fieldone>
</row>
<row>
<fieldone>12345</fieldone>
</row>
<row>
<fieldone>US</fieldone>
</row>
.
.
.
.
Till 35th field.
Please Help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Got Below error.
Conversion initialization failed: java.lang.Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found: Parameter 'row.fieldFixedLengths' or 'row.fieldSeparator' is missing Consistency check: no. of arguments in 'row.fieldFixedLength' does not match 'row.fieldNames' (0 <> 37)
I can not use fixed length because, each field separated by new line and length is not fixed.
I just changed file format as below
1
0.0
Original
12345
US
.
.
.
35field
~
and changed FCC config as below, Still i am getting incorrect output.
<row>
<fieldone>1</fieldone>
</row>
<row>
<fieldone>0.0</fieldone>
</row>
<row>
<fieldone>Original</fieldone>
</row>
<row>
<fieldone>12345</fieldone>
</row>
<row>
<fieldone>US</fieldone>
</row>
.
.
.
.
Till 35th field.
If I change field separator as ~, it is working fine irrespective of endSeparator.
Does fieldSeparator 'nl' support in File sender FCC? is it standard?
I did, Still no luck.
http://scn.sap.com/thread/3446054
Can you check Indrajit responce in above thread. Is it true? Can't we use field separator for new line?
Hi Mohan,
Since i was on SCN Indrajit suggestions are totally trustworthy. However, the file structure on that thread is different because it had more than one row.
I checked the point 49 (49. FCC parameter 'endSeparator' does not work for non printable characters) on the note 821267 - FAQ: XI 3.0 / PI 7.0 / PI 7.1 / PI 7.3 File Adapter
The problems seems to be on the endSeparator parameter but not in the fieldSeparator parameter.
How have you generated that file?. Only for testing purposes, have you tried to set a tab on the end of each line, to do new lines with notepad (win) or vi (linux)?
Regards.
Thanks for the update.
I have received test file from client.
As per 49 point, which one do i need to use as end separator now at the end of the line? so that i will ask client to add after successful testing.
I am getting .txt file from client. so it is notepad.
Modified file with including tab for each line. Help me on which end separator will work so that will test. so far I tried '0', +, 'nl', ~.
Mohan,
let me tell one thing about txt file, how its proccess in PI.
txt file should be have rows and column, rows mean records and columns means fields.
so your case is all fields which are 35 fields being is differt line , that means you must consider each field as record, not column.
here you can just creat structure as i posted earlier, which is sender only one filed..that field should poll all data and send to target 35 fields using UDF.
i hope you understood.
BR,
Maheswarareddy
Hi Vishu,
I have configured FCC as per below discussion for 35 fields.
And initially when I tested, I received below error
Getting error as "Conversion of file content to XML failed at position 0: java.lang.Exception: ERROR consistency check in recordset structure validation (line no. 37: missing structure(s) in last recordset"
Once I tried by setting a tab on the end of each line. it is working fine. I am getting expected result.
So it is text file and PI can read as new line only if tab is included in end of the field. Is my understand correct?
If so i will ask client to add tab for each end of the field saying that PI will treat as new line only if tab is specified.
Appreciate your response.
When I use configuration as you mentioned.
Record Structure : row
row.fieldNames: field
row.endSeparator: 'nl'
Initially it shown error for record structure, because we can't use row. we should use either row,1 or row,*
After that, It is throwing error as field separator / field fixed length mandatory value missing.
Let me explain. I am considering 10 source fields instead of 35.
My source file with below data with tab. testing is completed successfully with only tab after each field. It is not working without tab.
1(tab)
2(tab)
3(tab)
4(tab)
5(tab)
6(tab)
7(tab)
8(tab)
9(tab)
10(tab)
I have created data type and configured FCC as below.
Data type Structure:
<row>
<field1>
<Value>
</field1>
<field2>
<Value>
</field2>
<field3>
<Value>
</field3>
<field4>
<Value>
</field4>
<field5>
<Value>
</field5>
:
:
:
:
<field10>
<Value>
</field10>
</row>
FCC Configuration:
Recordset Structure: field1,1,field2,1,field3,1,field4,1,field5,1,field6,1,field7,1,field8,1,field9,1,field10,1,
ignoreRecordsetName - true
field1.fieldNames - Value
field2.fieldNames - Value
field3.fieldNames - Value
field4.fieldNames - Value
field5.fieldNames - Value
field6.fieldNames - Value
field7.fieldNames - Value
field8.fieldNames - Value
field9.fieldNames - Value
field10.fieldNames - Value
field1.fieldSeparator - 'nl'
field2.fieldSeparator - 'nl'
field3.fieldSeparator - 'nl'
field4.fieldSeparator - 'nl'
field5.fieldSeparator - 'nl'
field6.fieldSeparator - 'nl'
field7.fieldSeparator - 'nl'
field8.fieldSeparator - 'nl'
field9.fieldSeparator - 'nl'
field10.fieldSeparator - 'nl'
So my file sender xml is coming in below format as expected.
<row>
<field1>
<Value>1</Value>
</field1>
<field2>
<Value>2</Value>
</field2>
<field3>
<Value>3</Value>
</field3>
<field4>
<Value>4</Value>
</field4>
<field5>
<Value>5</Value>
</field5>
:
:
:
:
<field10>
<Value>10</Value>
</field10>
</row>
Still I am confused on why PI cannot able to read new line in notepad without tab? is it standard functionality?
Hi Mohan,
Okay, now I understood how you have configured.
I am just thinking it will be cumbersome since you have 35 fields.
Can you try giving
Recordset structure as row,1
..fieldNames .....
..fieldSeparator 'nl'
i.e. just like your first configuration but here while testing make sure that each field in the file is tab delimited and in lines. Also, make sure the last field value also follows the same rule.
Hope this works..
I have tried this yesterday itself after Iñaki Vila response.
For safer side, tried now also.
I am getting below xml which is not expected.
<?xml version="1.0" encoding="utf-8"?>
<ns:MT_Test xmlns:ns="namespace">
<row>
<status>1</status>
</row>
<row>
<status>2</status>
</row>
<row>
<status>3</status>
</row>
<row>
<status>4</status>
</row>
<row>
<status>5</status>
</row>
<row>
<status>6</status>
</row>
<row>
<status>7</status>
</row>
<row>
<status>8</status>
</row>
</MT_Test >
Why PI cannot able to read new line in notepad without tab? is it standard functionality?
Unfortunately, client did not accept to set tab at the end of each line.
So, now i need to handle this with in PI. Thought of creating java mapping to read txt file and differentiate each field by new line and pass the same to target structure.
Closing this thread and will create new discussion if i have any doubts on java mapping.
Thanks you everyone for your help.
Hi Mohan,
Source:
one
two
three
if you share data is looks exact, i mean each line you should be pick and shared to target field. if that is currect.
you can create source structure like below.
<MT_test>
<row>(0..to..unbounded)
<field>(0..to 1)
and FCC should be like below.
Record Structure : row
row.fieldNames: field
row.endSeparator: 'nl'
and then coming to mapping , you should be able to convert all lines which has single field( here filed) to target each filed.
Note: you no need to go java mapping.
if i am thinking wrong pls share exact source file(txt) which you had. so that some one can easily help you.
BR,
Maheswarareddy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mohan
I heard that, we can not use field separator as 'nl'. Is it true?
You can try with ´nl´ (including the quotation marks), at lest it work on the receiver side, on the sender side i am not sure
if so is it mandatory to use java mapping for this requirement?
This is not java mapping, java mapping is a type of mapping after this conversion. This conversion is called file content conversion and is used to transform a plane file to a XML file. Check this example File Content Conversion - Process Integration - SCN Wiki
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please use below parameters for your req.
Record Structure : Row
Row.fieldNames Field1,Field2,Field3
Row.endSeparator: 'nl'
If incase the file is comma separated then you can use fieldSeparator.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.