cancel
Showing results for 
Search instead for 
Did you mean: 

Discard lines from File

Former Member
0 Kudos

Dear All,

I have an inbound file to PI.

In the file, there are few lines which are not to be used ... those appear in the top, bottom as well as somewhere in the middle of the file.

I know how to take care of undesired lines from the top, but how to take care of those coming in the middle and the bottom? The number of rows for these undesired extra lines in top, middle and bottom of the file will always be fixed.

Example:-

TOP_LINE1 (Extra line)

TOP_LINE2 (Extra line)

DATA_LINE1

.

.

.

MID_LINE1 (Extra line - HELP required)

MID_LINE2 (Extra line - HELP required)

DATA_LINE1

.

.

.

BOTTOM_LINE1 (Extra line - HELP required)

BOTTOM_LINE2 (Extra line - HELP required)

BOTTOM_LINE3 (Extra line - HELP required)

As I mentioned earlier, the number of rows for these extra lines will always be fixed.

Any suggestions / help will be highly appreciated.

Thanks,

--Abhi

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>>The number of rows for these undesired extra lines in top, middle and bottom of the file will always be fixed.

why not create a date type that will inport those additional lines as normal lines

and just remove them in the mapping ?

Regards,

Michal Krawczyk

Former Member
0 Kudos

Thanks Michal for your reply.

But my scenario is a little complex. I will explain here.

1. The file is having data for CONSUMERS and PROVIDERS.

2. After the top_line undesired rows, is the section for the CONSUMERS.

3. After the mid_line undesired rows, is the section for the PROVIDERS.

4. In the file CC, if I specify RECORDSET STRUCTURE - CONSUMERS,,PROVIDERS, - it complains for keyfieldname.

What am I supposed to put in keyfieldname? I don't have any ...

A sample of the inbound file:-

,,,,,"Division",,,,,,,,,,,,,,,,,,,,,,,,,,,,

,,,,

,,,,,,,,Inventory Report,,,,,,,,,,,,,,,,,,,,,,,,,

,,,,

,,,,

,,,,

Consumer Owner : ABC ,,,,

Consumer :,,,,

Name,Contact,ID,Addr1,Addr2

John White,203 111 2222,1234,,

J D Edwards, 732 020 1121,South West Drive,NJ

Number of Consumers : 201,,,,

,,,,

Providers :,,,,

ProviderName,Location,LicenseNumber,Contact

ABC,NJ,1001,1800 000 0001

DEF,NY,1005,1 888 000 0001

,,,,

Number of Providers : 102,,,,

,,,,

,,,,

,,,,

,Summary,,,

,,,,

I just need the data from the bold rows. Rest of the rows should be discarded. I have desinged the structure like this -

<MT>

<rec>

<Consumer><Name> ... </Consumer>

<Provider><ProviderName>...</Provider>

</rec>

</MT>

Hope the requirement is clear. Kindly help.

Thanks a lot,

--Abhi

sunil_singh13
Active Contributor
0 Kudos

Hi Abhi,

Develope a module and in that before doing the content conversion remove the unwanted lines from the file.

Another option in the File adapter "Run Operating System Command before Processing" may also help. using this you can remove (by writing script) the unwanted content and then process the file.

But I think the Option of doing it in Message mapping would be good but as you said you dn't have key field for them, you can use some combination like skip the top line inn FCC. After doing that you will left with removing the middle and bottom line.

treat those as normal part of the message and filter them in mapping.

Thanks,

Sunil Singh

Former Member
0 Kudos

Hello Sunil, thanks for your reply.

I have never developed a adapter module, so i am not sure whether that approach is good. Although it definitely sounds good.

But even if I do write an adapter module, how come I will get the value for "keyfieldname"?

Thanks,

--Abhi

VijayKonam
Active Contributor
0 Kudos

You have to go as Michael said. Since you do not have key field identifier, you have to read all the file and eliminate the unwanted lines and spearate the providers and consumers in your mapping program.

VJ

Former Member
0 Kudos

What you can do is just pick your file as it is (row by row) into your mapping and then you just do the mapping for desired fields only.

First of all create one simple data type to pick the file as it is..

<MT_SourceFile>
  <Records>             (0..unbounded)   
     <Items></Items>    (0..1)
  </Records>
</MT_SourceFile>

Do your sender FCC as shown below

Recordset Structure Records,*

Records.fieldNames : Items

Records.fieldSeparator: 'nl'

ignoreRecordsetName: true

Regards,

Sarvesh

sunil_singh13
Active Contributor
0 Kudos

Abhi,

If you have not developed Adapter module before then it would be bit time consuming for you, The Idea behind using this approach was to eliminate what is not required first and then deal with what is required using FCC in adapter.

I would advice you to use combination approach. Wherin first you eliminate the first row in FCC and then removing of middle and bottom fields can be done in Mapping as other folks have suggested.

Thanks,

Sunil Singh

Former Member
0 Kudos

Thanks everyone for their valuable suggestions.

As Michal suggested, I will try to clean up the payload in the mapping ... full points to him, rest of the folks equally awarded.

I am closing the thread, but might open it again if I get stuck up somewhere

Thanks and I appreciate your kind efforts.

--Abhi

Answers (0)