cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a counter to a filename that resets daily

Former Member
0 Kudos

Dear,

I'm trying to add a counter to a filename, but I want it to reset daily.

So on monday if I send three files I want file_1, file_2 and file_3. On tuesday it should once again be file_1, file_2, etc.

I'm using the Counter option in the File Receiver Communication Channel but I don't see the optino to reset it daily. Is this an option, or will I have to work with a Z-table on the PI machine, fill up my counter dynamically in the Message Mapping and then use dynamic variables?

Kind regards,

Frederik-Jan.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Right, so RFC call in Message Mapping and retrieve the amount of processed msgs from a z-table in PI. /shrug

Pity though they didn't supply a simple reset parameter.

Thanks!

Frederik-Jan.

former_member187339
Active Contributor
0 Kudos

Hi,

I think this caanot be done as the file counter variable is stored in memory. Whenever a j2ee engine restart happen it get reset. Check this note:

>>Note 821267 - FAQ: XI 3.0 / PI 7.0/ PI 7.1 File Adapter

It is stated there that

Q: After configuring a File Adapter receiver channel with the File Construction Mode set to "Add Counter", I noticed that the counter gets reset each time I restart the J2EE engine.

A: This behavior is by design. The current counter value is not persisted, but only kept in memory. It is intended to generate distinct file names, but not strictly increasing numbers. After a J2EE restart, the File Adapter will start writing messages beginning with the smallest free counter number (skipping existing larger numbers).

I would suggest you to try handling this in Message Mapping. Then you need to create the file name and overwrite using Dynamic Configuration. There you can see whether the day is Monday and reset the value!!!

Regards

Suraj