cancel
Showing results for 
Search instead for 
Did you mean: 

How to change timestamp ?

Former Member
0 Kudos

We have scenario proxy to file(SFTP) PI 7.1

For each trigger from proxy...data is split into 3 files (multimapping used) with filenames as :

abc<yyyyMMdd_HHmmss>.txt

def<yyyyMMdd_HHmmss>.txt

xyz<yyyyMMdd_HHmmss>.txt

The timestamp should be same for all three files for each trigger.

Now the issue is that even if PI takes one more second for any of the split to process, the timestamp will vary by 1 second.

e.g. for each trigger filenames should be:

abc20140606_125417.txt

def20140606_125417.txt

xyz20140606_125417.txt

if the delay in processing of any of the split is by one second..filenames will be:

abc20140606_125417.txt

def20140606_125418.txt

xyz20140606_125419.txt

As proxy is triggered a number of times a day, I cannot hard code the time part in timestamp.

Can anybody help me in meeting this requirement ?

Accepted Solutions (0)

Answers (3)

Answers (3)

Ryan-Crosby
Active Contributor
0 Kudos

Hi Saurabh,

If this is triggered via proxy then why not simply add a timestamp as a parameter within the proxy that would be used via each mapping?  That way you don't have to worry about how long it takes for PI to process the files.

Regards,

Ryan Crosby

ambrish_mishra
Active Contributor
0 Kudos

Hi Saurabh,

IMO, it is not possible to meet this requirement through a standard solution.

However, What you can do is, let PI create the files in a temp folder with the timestamp (obviously millisecs would change) and get Basis to create a script that move the files to another folder with the timestamp you need by simply copying the time from the first file created to the other 2 files...

it may also happen that one of the 3 files is created in a different second. This will cater to that eventuality as well.

Cheers

Ambrish

Former Member
0 Kudos

Thanks for reply Ambrish.

The solution you said can be implemented in SAP PI as well. But we are looking a bit simpler way to deal with it.

If not found then we will consider other approaches as well, no matter how tedious then.

ambrish_mishra
Active Contributor
0 Kudos

I know what you mean but I have faced this. There is no standard way. PI will add the timestamp based on when the file is getting created.

Former Member
0 Kudos

Hi,

Try the below option.

Add the time stamp to a field in target side payload in mapping .Use this field value to set the file name in your module.

Now to remove the field in your target structure use "RemovePayloadValueBean" in your channel.

Regards

Venkat

Harish
Active Contributor
0 Kudos

Hi Saurabh,

If you are using dynamic configuration for file name and setting the file name in mapping, then set the second to 00 in UDF.

regards,

Harish

Former Member
0 Kudos

No Harish we are not using dymamic configuration in mapping. We are setting file name in SFTP adapter in modules.

Harish
Active Contributor
0 Kudos

Hi Saurabh,

then the only option is to put 0 in place of ss. I never tried this but you can give a try.

abc<yyyyMMdd_HHmm00>.txt

regards,

Harish

Former Member
0 Kudos

The issue is that the proxy is getting triggered twice or thrice in a span of 60 seconds, thus if i put zeros in place of ss.

in first trigger at say 10th second of 31st minute I will get files as :

abc20140606_123000.txt

def20140606_123000.txt

xyz20140606_123000.txt

now say if the proxy it triggered any time with in 31st minute, I will still get files as:

abc20140606_123000.txt

def20140606_123000.txt

xyz20140606_123000.txt

If somehow I can pick start time from moni and use it in timestamp in filename, i should be able to find solution then, but I am not sure how to go about it. That way I will have unique and same time for all three files, because each proxy trigger will reflect unique start time in SAP PI in moni.

Any other ideas ? It seems simple at first and but this requirement is quite tedious.

Harish
Active Contributor
0 Kudos

Hi Saurabh,

Then the only option is to append time stamp from message mapping (dynamic configuration). the same time stamp can be append to all three file name.

regards,

Harish