Sidebar

Tracking last time a channel ran

0 votes
352 views
asked Apr 11, 2018 by chris-c-9050 (200 points)
I'm creating a new export channel and would like to be able to track the last time the export runs.  I have other export channels and can see in them that their Channel Cache contains a key named "LAST_RUN" that stores the date but for the life of me can't find where that is getting set.

1 Answer

+2 votes

The LAST_RUN is typically set on a channel that has a script as an input. Most of those channels are looking for records in a DB from the last run until this run. 

For your implementation the simplest way to get what you want is to add a function in the channel to set a Last Message time stamp here are a few options.

1. Setup a standard mapping function

2. Setup a custom mapping function in one of your scripts here is the code:

channelCache.setValue("Last Message", qie.getSystemDate());

3. Add it to the ack script on the destination if you want it to verify message was sent first using the same code:

channelCache.setValue("Last Message", qie.getSystemDate());

answered Apr 12, 2018 by brandon-w-8204 (33,270 points)
commented Apr 12, 2018 by chris-c-9050 (200 points)
Thanks! Can I access this variable in the DB Query input node to restrict results to results that occur after that date?
commented Apr 12, 2018 by brandon-w-8204 (33,270 points)
You have to do it as a custom script. This is because you have to update the cache after you run the query.
...