on 12-31-2008 9:24 AM
hi all,
i'm using file adapter receiver and want to generate an fixed length text file. the name of the text file i want to generate it dynamically based on a field of the xml.
the structure of xml:
<mt_PO>
<Header>
...
</Header>
<Detail>
...
</Detail>
<Filename>
</name>
</Filename>
</mt_PO>
For generate the name of the file i'm using variable substitution in this way:
var1 -> payload:mt_PO,1,filename,1,name,1
and in the file name schema field: PO.%var1%.txt
this it's correctly done.
After, for generate the text file in the format i want i use content conversion:
RecordSet structure: Header,Detail,filename
Name Value
Header.addHeaderLine 0
Header.fieldFixedLengths 2,2,10,10,8,100
Header.endSeparator 'nl'
Detail.fieldFixedLengths 2,5,18,35,35,13,3,13,5,35,12,40,60,40,10
Detail.endSeparator 'nl'
filename.fieldFixedLengths 0
filename.fixedLengthTooShortHandling Cut
The problem is that resulting text file is generated with an empty line to the end, and that is my problem. i don't know how to avoid generate that empty line.
has anybody been in the same scenario and know how to solve this issue?
Thanks.
Hi,
With FixedFieldLength you can't avoid this empty line. If you would have to supress then its possible with fieldSeperator.
For this instead of variable substitution like this, I would suggest you to go for Dynamic file configuration in mapping.
Refer the code from below link given by Bhavesh Kantilal
Thanks
Swarup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Ok No problem, let me give you the blog which contains all the steps,
Here you need to create one UDF in mapping and have to map it with target Message Type.
Remove the filename from Target side structure.
Thus at runtime it will take the value from Source side payload (Or you may pass any values in mapping )
and that will be used in communication channel.
The given blog have used HTTP as receiver communciation channel.
For file adapter you need to fill-up below parameters with variable substitution.
File Name Scheme : %Var1%
Variable substitution -- enable
-
>Var1----
>message:message_id
Adapter Specific Attributes
Mark Filename & Use Adapter Specific attributes.
PS Note : once you apply this UDF the mapping will give exception while testing from test tab. Let it be.
This UDF will work on Runtime. Thus execute the scenario to see the results.
Thanks
Swarup
hi Swarup,
if I enable variable substitution and I assign message:message_id to 'var1', the name of the file that i get doesn't have the value from the mapping of the message mapping, but i get the message_id from the soap envelope.
what do i must to do to get the value that I passed throught the udf in the mapping?
Thanks, Fabian.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.