cancel
Showing results for 
Search instead for 
Did you mean: 

Sender File Adapter and content conversion

Former Member
0 Kudos

Hi,

How can we remove the last line from the file using content conversion?

The last line should not be read from the input file.

Like for the first line we can use Document Offset .......similarly do we have any option for the last line?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

>>Like for the first line we can use Document Offset .......similarly do we have any option for the last line?

Nope. There is no standard feature that will help you here. You need a custom developed adapter module or handle it in the mapping.

Regards

Jai

Former Member
0 Kudos

Thanx Jai.....but Can you please throw some light on how it can be handled in mapping?......Do I have to write some code or what.....as already the mapping is too bulky and crowded.

Former Member
0 Kudos

THe existing mapping you have is a graphical mapping or a Java mapping? If it is a Java mapping then the solution is very simple, just write a few lines of code to remove the last occurrence of every node in the input XML. If you have a graphical mapping, then you need queue based processing of each field and then a small udf to remove the last element of it. This approach might be very tedious if your mapping is already complex.

You can go for a Java mapping where you just remove the last nodes and then trigger this actual graphical mapping. This might be easier.

Former Member
0 Kudos

Thanx Jai......I need to do it in graphical mapping itself.

In other case.....Do you have any idea about this case :-

I have specified the key field name but i cant use any key field value as that is not same in all the rows......so can i read all the rows and also i don't have to specify the keyfield value. Key field is needed as i have specified Emp,,Sub, and under Emp all the rows dont have the same key field value and the values can be changed from file to file so i dont need to specify the key field value....

Plz help me as I require this solution urgently

Former Member
0 Kudos

>>Thanx Jai......I need to do it in graphical mapping itself.

That is why I suggested to have the graphical mapping as it is. But before invoking this graphical mpping invoke a small java mapping that will remove the extra line for you. You can have multiple mappings in the same scenario.

>>I have specified the key field name but i cant use any key field value as that is not same in all the rows......so can i read all the rows and also i don't have to specify the keyfield value. Key field is needed as i have specified Emp,,Sub, and under Emp all the rows dont have the same key field value and the values can be changed from file to file so i dont need to specify the key field value....

Can you give an example of your input file with some dummy values? I find it very difficult to understand with this description.

Former Member
0 Kudos

date Empno Empname

19.03.2009 12345 Neel

20.03.2009 34566 Neelkanth

EmpDes Japan 100

The file is like this first row i have removed using document offset.......from 2nd row till nth row the structure is as shown above and the last row has no. of fields 1 less than all other rows and also its root node is different like shown above its rootnode is EmpDes..........How to use File content conversion for this?

Former Member
0 Kudos

And in addition to this i have used

EmpNo,,EmpDes, under recordset specification.

Shabarish_Nair
Active Contributor
0 Kudos

>

> date Empno Empname

> 19.03.2009 12345 Neel

> 20.03.2009 34566 Neelkanth

> EmpDes Japan 100

>

>

> The file is like this first row i have removed using document offset.......from 2nd row till nth row the structure is as shown above and the last row has no. of fields 1 less than all other rows and also its root node is different like shown above its rootnode is EmpDes..........How to use File content conversion for this?

do you want to avoid the last line i.e

EmpDes                 Japan        100

?

in that case the 3 options are

1. use a adapter module and remove the last line - this is the ideal option

2. use a OS script - will work but only if you are using the NFS option in the file adapter instead of FTP

3. read that also using content conversion (treat it as a trailer) and ignore it during the mapping

Former Member
0 Kudos

Thnx Sabarish....

I am using NFS as file system. So operating system command can work but what to write?

and also how to avoid the last line in mapping.......I have already not mapped them to anything......but then also its coming in the node.....?

Plz throw some light on both the solutions.

Former Member
0 Kudos

The problem is still there

Former Member
0 Kudos

i have read that in Content Conversion but how to ignore in mapping and also plz specify the OS script

Shabarish_Nair
Active Contributor
0 Kudos

it is not an issue even if you read the file inside

just dont map those fields to the target xml. This is the easiest solution

Former Member
0 Kudos

I have not mapped them but like this I m getting error in SXMB_MONI and the request mapping is not getting generated.

the whole file is getting read

Actually EmpDes Japan 100 are coming under the nodes of date Empno and Empname........so the request structure is not getting generated.

Former Member
0 Kudos

Can we have two key field values defined for the same structure?

Former Member
0 Kudos

>

> I have not mapped them but like this I m getting error in SXMB_MONI and the request mapping is not getting generated.

>

> the whole file is getting read

> Actually EmpDes Japan 100 are coming under the nodes of date Empno and Empname........so the request structure is not getting generated.

If you say that empdes, japan& 100 are coming under date, empno and empname then it means that you have not identified the trailer properly in FCC.

What Shabarish mentioned should work.

Former Member
0 Kudos

Actually, I can't use keyFieldValue as i don't have some common key in all the rows ......i have 2 keyFieldValues for the same structure......if that can be used then it will solve my purpose....

Former Member
0 Kudos

Can 2 keyFieldValues be used for the same structure

for eg:- for half of the records I have 01 as the key field value and for the other half we have 02 as the key field value

Former Member
0 Kudos

Hi,

Map like below.

dateremovecontext-startswithNotTarget Structure.

Constant(E)----


Fields map like one to one.

Regards,

Prakasu.M

Answers (1)

Answers (1)

sunilchandra007
Active Contributor
0 Kudos

Hi,

You can simply do this by using Operating system Command parameter while configuring Sender Communication channel (FTP Adapter).

For reference just have a look at ...

XI/PI: Command line sample functions

/people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions

Regards,

Chandra