cancel
Showing results for 
Search instead for 
Did you mean: 

Receiver file adapter

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Excuse me Swarup,

could you give me an example or some thoughts about Dynamic file configuration in mapping, i have gone through the thread you gave me but i haven't got it clear at all. i'm a little bit lost.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Swarup,

if i enable variable substitution and i give the value message:message_id, i get in the resulting file the name of the message_id, not the value from the mapping of the message mapping done with the UDF.

could u give any advice?

Thanks, Fabian.

Former Member
0 Kudos

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.