cancel
Showing results for 
Search instead for 
Did you mean: 

Sender File Adapter With Condition

brian_briones
Participant
0 Kudos

Hi gurus,

I'm configure FTP FILE ADAPTER with content conversion, and need aplicate condition for processing the files.

Example:

FILE1.TXT

ABC,PRODUCT,PRICE,DESC

ABC,PRODUCT,PRICE,DESC

FILE2.TXT

DEF,OTHER,OTHER,OTHER

DEF,OTHER,OTHER,OTHER

well, I need get the FILE1.TXT because this one have the key ABC first and archive, but musn´t move the FILE2.TXT because dont have the key ABC.

can aplicate this condition on FTP/FILE ADAPTER?

Help.

Regards Friends

Accepted Solutions (1)

Accepted Solutions (1)

javier_alcubilla
Contributor
0 Kudos

Hi Brian

Maybe you could create a generic content conversion, and depending on data, apply different mappings/conditions

Content conv like

COL1, COL2, COL3 COL3

ABC,PRODUCT,PRICE,DESC

ABC,PRODUCT,PRICE,DESC

DEF,OTHER,OTHER,OTHER

DEF,OTHER,OTHER,OTHER

In the receiver det if COL1#ABC then redirect to another File Receiver


Regards

Javi

brian_briones
Participant
0 Kudos

Hi Javier, on receiver I can, but the question is, can is on Sender?

former_member184720
Active Contributor
0 Kudos

If you do not want to process those files -instead of processing the files directly, you will have to use the OS commands/script scheduled on your FTP server.

The script should have the logic to filter the files based on it's content.

Ideally it's the sender system responsibility to stop sending such invalid files.

However as Inaki mentioned, you can pick those invalid files and drop at the same location with a different file name/extension to aovid recursive processing

brian_briones
Participant
0 Kudos

Well, apparently isn't possible, regards friends for yours suggestions

former_member184720
Active Contributor
0 Kudos

Never tried but - During the content conversion if the key value is not present in the file, the channel will throw an error right?

Also there is an option to archive faulty source files so i believe you can move such files into different directory.

May be you can try and confirm

Answers (5)

Answers (5)

anand_shankar10
Active Participant
0 Kudos

In receiver determination add a condition that if the key is equal to ABC.

Is there any problem doing this.

Thanks

Anand

Former Member
0 Kudos

Hello,

Which version of PI u r using?

In case u r using PI7.31 (single stack) then u can think of using XML validation (apparently, u have to assign "ABC" default value to ur Key field while creating Data type) so in case file doesn't have ABC as its key value then that file will be transferred to some error folder.

The only downside is ur second file will be moved from main folder...

Note - i haven't tried this kind of solution but may be u can give a shot.

Thanks

Amit Srivastava

brian_briones
Participant
0 Kudos

is pi 7.0 😕

Former Member
0 Kudos

Hello,

Hmm...in that case personally i would have opted java mapping

1) Using java mapping read the file content and if key "ABC" is not present then move the file to error folder otherwise transfer it to some temp processing folder.

2) Pick files from processing folder and continue with normal scenario.

Thanks

Amit Srivastava

Former Member
0 Kudos

Brian,

I'd suggest to create an OS script that renames files containing ABC to a different extension and have PI poll those files.

Regards,

Koen

Former Member
0 Kudos

Hi Brian,

try to negociate with your source application to have different filename !

regards

Mickael

brian_briones
Participant
0 Kudos

the file name is random!

iaki_vila
Active Contributor
0 Kudos

Hi Brian,

As far as i know you can't process the data inside the files at standard adapter level but you can do a workaround. In the integration directory under condition option you can access to this value (if you have ESR development), if the condition result is true you can drop the file in the source path.

Regards.