cancel
Showing results for 
Search instead for 
Did you mean: 

File name should be with sequence

former_member217945
Participant
0 Kudos

Hello Experts,

I am working on file(NFA) to SFTP scenario with out mapping . I am getting file from AL11 folder with the name of XXXX_20150404033752.csv and receiver side (in PI) im getting file name as XXXX_20150404-040420-142.csv. But it should be 20150404033752_001_csv with out "-" and it should be sequence of 001, 002,... .

For example, if the files were given a name corresponding to a time stamp, the first file might be called 20150404040420_001.  The second would be called 20150404040420_002.  These files were both named after the date and time stamp April 04, 2015 at 04:05:02.


Without doing any mapping can I do this?


Thanks in advance,

Reddy.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member217945
Participant
0 Kudos

I have one more doubt

I am sending .csv file to sftp server and after a file is successfully retrieved, it should be renamed to replace the “.csv” file extension with a “.got” file extension. 

Is this posibble to do in PI?

Thanks,

former_member184720
Active Contributor
0 Kudos

>>>I am sending .csv file to sftp server and after a file is successfully retrieved, i v

Are you sending or retrieving?


Please do not merge multiple questions into one. Close this thread if the initial issue has been resolved and create a new thread for any further questions.

former_member184720
Active Contributor
0 Kudos

>>>I am working on file(NFA) to SFTP scenario with out mapping . I am getting file from AL11 folder with the name of XXXX_20150404033752.csv and receiver side (in PI) im getting file name as XXXX_20150404-040420-142.csv


If you want to append a counter to the source filename


  • enable ASMA for file name in sender and receiver channels
  • Set the file construction mode in receiver channel to counter
  • under counter def, maintain "_" as prefix and counter to 000

>>For example, if the files were given a name corresponding to a time stamp, the first file might be called 20150404040420_001.  The second would be called 20150404040420_002.

Do you expect two files with the same timestamp? There should be some difference in the filename right as you can't have 2 files with samename.

If appending the counter doesn't work, either you have to go for a java mapping/AM to set the file-name as you want.

Dynamic file name for pass-through scenario - Process Integration - SCN Wiki

former_member217945
Participant
0 Kudos

Hi Hareesh,

Thanks for the reply .

  • >>>>>Set the file construction mode in receiver channel to counter , under counter def, maintain "_" as prefix and counter to 000

I am using SFTP adapter in receiver  channel and i ddnt find any file construction mode option in receiver channel. Is there any other option to do this?

>>>>>Do you expect two files with the same timestamp? There should be some difference in the filename right as you can't have 2 files with samename.

sorry,  two files with different timestamp.

Thanks

former_member184720
Active Contributor
0 Kudos

>>>I am using SFTP adapter in receiver  channel and i ddnt find any file construction mode option in receiver channel. Is there any other option to do this?

Sorry i missed that. Then i don't see any option than going for a java mapping/AM. It's available only with NFS

former_member217945
Participant
0 Kudos

Hi Hareesh,

If you will provide me steps to do  mapping and udf for my requirements that would be very helpfull.

Thanks

former_member184720
Active Contributor
0 Kudos

As you need to counter for every file, you need to have mechanism to generate the sequence number


You can go for RFC/DB lookup for the same.

Refer to below blog -

Once you have that, everything else it straight forward.

-> enable the checkbox for "filename" in your sender file channel

-> in your mapping, add a UDF to read the filename and append the counter using a UDF. You can search for "dynamic filename UDF" in in SCN. You can find lot of blogs. <<if you can't go for graphical mapping, then make a RFC call in your java mapping)

reference : User-defined Mapping Function for RFC Lookup - Code Gallery - SCN Wiki

-> enable the checkbox for "filename" receiver channel too.