on 07-14-2009 10:38 AM
Dear Guru's,
I have to solve following problem with XML (with mulitiple records) to TEXT file scenario using file adapter. I have to output for ever ONE data record in XML always two identical lines in text file. Second line should have a little bit different mapping in few fields like date,... So I did duplicate fileds in my output structure in mapping and need to know how to set line break in the middle and see half of structure in first line and next structure half in second line
_______________________________________________________________________________________________________________________________________________________________________________
My output structure in mapping is:
CASHFLOW
- INTERFACE
- GESELLSCHAFT
- ANWENDUNG
- PRODUKT
- VERTRAG
- BETRAG
- WAEHRUNG
- DIRECTION
- BEWEGUNGSTYP
- FAELLIGKEIT
- ZINSFESTSTELLUNG
- ZAHLUNGSTAG
- RENDITE
- INTERFACE2
- GESELLSCHAFT2
- ANWENDUNG2
- PRODUKT2
- VERTRAG2
- BETRAG2
- WAEHRUNG2
- DIRECTION2
- BEWEGUNGSTYP2
- FAELLIGKEIT2
- ZINSFESTSTELLUNG2
- ZAHLUNGSTAG2
- RENDITE2
_______________________________________________________________________________________________________________________________________________________________________________
Question is how can I set on receiving file adapter in Content Conversion Parameters that fields from first structure half INTERFACE...RENDITE should be outputed in one line and fields from second half of structure INTERFACE2...RENDITE2 should start on second line in final text file.
_______________________________________________________________________________________________________________________________________________________________________________
I'm getting at the moment one line only and I need to know how can set line break so that second line starting with INTERFACE2(CA)...RENDITE2 will start in new line.
CA,"0100","7","512",20090127010001,-12454762586.6800,"EUR",2,12,2009-01-28,2009-01-27,2009-01-28,"0.0000000",CA,"0100","7","512",20090127010001,-12454762586.6800,"EUR",1,10,2009-01-27,2009-01-27,2009-01-27,"0.0000000"
_______________________________________________________________________________________________________________________________________________________________________________
This should be final output:
CA,"0100","7","512",20090127010001,-12454762586.6800,"EUR",2,12,2009-01-28,2009-01-27,2009-01-28,"0.0000000"
CA,"0100","7","512",20090127010001,-12454762586.6800,"EUR",1,10,2009-01-27,2009-01-27,2009-01-27,"0.0000000"
_______________________________________________________________________________________________________________________________________________________________________________
My file adapter settings:
RecordsetStructure=CASHFLOW
CASHFLOW.fieldNames=INTERFACE,GESELLSCHAFT,ANWENDUNG,PRODUKT,VERTRAG,BETRAG,WAEHRUNG,DIRECTION,BEWEGUNGSTYP,FAELLIGKEIT,ZINSFESTSTELLUNG,ZAHLUNGSTAG,RENDITE
CASHFLOW.fieldSeparator=,
CASHFLOW.endSeparator='nl'
CASHFLOW.fieldNames=INTERFACE2,GESELLSCHAFT2,ANWENDUNG2,PRODUKT2,VERTRAG2,BETRAG2,WAEHRUNG2,DIRECTION2,BEWEGUNGSTYP2,FAELLIGKEIT2,ZINSFESTSTELLUNG2,ZAHLUNGSTAG2,RENDITE2
CASHFLOW.fieldSeparator=,
_______________________________________________________________________________________________________________________________________________________________________________
It wont help if I add two identical structures in mapping because in output i would see for multiple entries section with first lines only and after that section with second lines only. And CASHFLOW is one part of more complex mapping ...
(This is final output structure RecordsetStructure=HEADER,CASHFLOW,CONDITION,REFERENCE,CONTRACT - more sections with different data and all these should have duplicate lines at the end)
_______________________________________________________________________________________________________________________________________________________________________________
Thanks a lot for any help
Cheers
Marian
Edited by: Marian Luscon on Jul 14, 2009 11:44 AM
Hi Mariam,
The default endSeparator is a new line. So You no do need specify "CASHFLOW.endSeparator" parameter.
On other hand, It is not possible to use the same recordset name to generate different outputs. You can handle it inside your message mapping. One option is put inside the value of "INTERFACE2 " a newline('nl').
I hope this helps you.
Regards
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ivan,
right, I did test just for sure.
Putting constant 'nl' into field CASHFLOW-INTERFACE1 didnt help - still getting one line instead two lines.
CA ,"0100" ,"7" ,"512" ,20090127GTP101 ,-12454762586.6800 ,"EUR" ,2 ,12 ,2009-01-28 ,2009-01-27 ,2009-01-28 ,"0.0000000" ,'nl' ,"GTP1" ,"7" ,"512" ,20090127GTP101 ,-12454762586.6800 ,"EUR" ,1 ,10 ,2009-01-27 ,2009-01-27 ,2009-01-27 ,"0.0000000"
So there is still question. Is there any way (mapping,...) how to output always 2 lines in text file for one record in XML. It always does 1 record in mapping structure = 1 line but we need 2 lines ...
Example:
Input: 4 records in XML
Output: 8 lines in final text file ...
Thanks to you all guys
Marian
Hi Marian,
You have not to put a constant 'nl' to must put a new line, It means include an ascii(13) inside the content of the "CASHFLOW-INTERFACE1" field.
For example this: "hi
world"; It inserts a new line between hi and world.
Regards
Ivan
Edited by: Jose Iván Reyes Arteaga on Jul 14, 2009 11:23 PM
Hi Ivan,
thanks for reply. I doesnt work.
"0.0000000"\nCA --> CASHFLOW-RENDITE
didn't create two lines
CA,"GTP1","7","512",20090127GTP101,-12454762586.6800,"EUR",2,12,2009-01-28,2009-01-27,2009-01-28,"0.0000000"\nCA,"GTP1","7","512",20090127GTP101,-12454762586.6800,"EUR",1,10,2009-01-27,2009-01-27,2009-01-27,"0.0000000"
Marian
Hi Kamath,
we need to see following output line one and two in pairs for ever record
Correct:
Record1 line1
Record1 line2
Record2 line1
Record2 line2
....
If I use 2 structures in mapping instead one, it will output first section with first lines and after that section with second lines.
Wrong:
Record1 line1
Record2 line1
Record3 line1
...
Record1 line2
Record2 line2
Record3 line2
...
Thanks
Marian
Hi Kamath,
you mean to create target mapping structure which has 2 fields instead current 26 fields and set fieldsSeparator to 'nl'?
Yes I was thinking already about that as a last option, because concatenation of all these 26 fields into new fields Line1 and Line2 would be very big and not very transparent or user friendly...
Thanks for reply
Marian
Hi guys.
we did solve it by an UDF in mapping, udf was added at first fiekd of second line.
Mapping:
CONSTANT(CA) -->UDF SetLineBreak -->INTERFACE2
Udf option cache with argument A:
-
public String UDF1(String a,Container container){
//write your code here
String string = ( new StringBuffer("\n")).append(a).toString();
return string;
Thanks for your help
Cheers
Marian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Marian
You can try this INTERFACE.beginseparator INTERFACE.endSeparator 'nl' after this use INTERFACE2.beginseparator AND INTERFACE2.endSeparator 'nl'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.