This custom trigger function is used to delete a file by end of month. This function use system date or custom date as a parameter.
See How to Create Custom Trigger Functions for details on installation.
Downloads
Source code and build instructions
How to Delete a File using IsEndOfMonth Function
Let me now show you how to implement that.
1. Make sure you have IsEndOfMonth function installed
Before creating a custom trigger using function IsEndOfMonth, you need to have build installed in the
server where JSCAPE MFT Server is running.
2. Create a Trigger to Delete a File by End Of Month
Login into admin console of JSCAPE MFT Server > Triggers and Click Add to create a Trigger
Give the trigger a Name and then select the Current Time event type from the drop-down list.
Click Next to Step 2 where a condition can be set to execute the trigger. Now Click Functions button to
select the IsEndOfMonth function.
IsEndOfMonth function has two method signatures
- IsEndOfMonth(yyyy,mm,dd)
This method signature is used to check whether a specific day falls by end of month. In order to make this method to function need to pass the year in YYYY,MM, DD format.
For example, In order to check whether 31st August 2018 falls by end of month, the parameters should be passed as IsEndOfMonth(2018,08,31)
- IsEndOfMonth(date)
This method signature is used to check whether the current day falls by end of month. In order to make this method to function need to pass the system date as parameter.System date can be retrieved using CurrentDate() Method
Use the method as below in order to check whether current day falls by end of month;
IsEndOfMonth(CurrentDate())
Since the event type is Current Time, on what time the trigger should be executed should be set along with the IsEndOfMonth function.
If the Trigger need to run on every day 10 PM add the condition Hour=22 along with IsEndofMonth(CurrentDate()) method as shown below
On Step 3 an action has to be added, in order to add an action click Add button and select the action "Delete File" from drop down list and Click OK
On OK there will be a parameter to input the file name to delete.
Input the required file to delete as above, Click Ok to save the settings.
That's it. Now you know how to use the custom function IsEndOfMonth and delete a file by end of month.