A long time ago I created simple ColdFusion page to display the specifications of all the ScheduledTasks defined on the server. I can’t remember if that was while we running CF6 or CF8, but the principle was to read the ‘neocron.xml
’ fil, extract all required info from it, and turn those data into a query object. Simple, and it worked well. Better yet: it continued to work when we moved all code to ColdFusion 11.
By accident I found out that the <cfschedule>
tag had been extended with a new action called ‘list
’, returning a Query. Clearly, that would be a much simpler solution that what we did in the past. Hence I set out to replace the existing code, to get the content of the file and add it to a Query, with a single line <cfschedule action=”list” result=”qTasks” />
. So far, so good.
But… There are a few issues.
The first issue is that there is a column called ‘group
’. If you try to select that column in a Query of Queries, ColdFusion 11 spits out an error message:
There are ways to rename columns in a CF query object, even in Adobe’s ColdFusion. This post explain two of them: https://blog.simplicityweb.co.uk/125/renaming-cfml-query-columns. Going from Query to JSON, then adapting column names, and then going back from JSON to Query is certainly possible. But that is not really an improvement on my original solution.
I simplified my display of the Query a bit, ignoring the category grouping I had in my older code. Then I hit another issue.
When I tried to display the date and time a ScheduledTask had last executed, I was sorry to see that not all rows had a value – even though all ScheduledTasks had effectively been run at least once, and did indeed display correctly in the ColdFusion Administrator console as well as in my old solution (meaning the dates are correctly stored in the ‘neocron.xml
’ file). Somehow the <cfschedule>
tag does not deliver the ‘lastfire
’/’last_fire
’ values (yes, there are two columns with almost the same name and identical data in that query result) – perhaps because some of the ScheduledTasks have an ‘Expired
’ status? Still, why not pass them on and let the developer decide when and how to deal with them? And why does the ColdFusion Administrator console display them correctly (because it does not use <cfschedule>
, of course) ?
Last but not least, although the query results are generated by ColdFusion, the dates in this particular query are not accepted by the ‘LSDateFormat()
’ function, which complained with messages like this one:
{ts '2021-11-04 15:20:00'} is an invalid date format.
I can only hope those issues with <cfschedule action=”list”>
are solved in one of the later versions of ColdFusion. Or do we have to migrate to Lucee in order to find less bugs?
Read Full Post »
You must be logged in to post a comment.