Relevance - returning different types

I have relevance that I want to return a date within a text file if it is appropriate, or some other string such as"Not installed" if it doesn’t exist. But if it does contain a date I would like Bigfix to treat it like a date so I can sort it in chronological order. However I’m finding that I can only return as a string. Is there any way I could get this relevance to return a date format when appropriate and otherwise return one of the strings?


if not exists file "/Library/Logs/CrashPlan/history.log.1" then "Not Installed!" else if not(content of file "/Library/Logs/CrashPlan/history.log.1" contains "Starting backup to ") then "Backup Never Started!" else maxima of ( (it as date ) of ( ((it as integer as string) of preceding text of last "/" of following text of first "/" of it ) & " " & (preceding text of first "/" of it as integer as month as three letters)& " " & "20" & (following text of last "/" of it as integer as string)) of preceding text of first " " of following text of first "I " of it) of lines whose (it contains "Starting backup to") of file "/Library/Logs/CrashPlan/history.log.1" as string

This is a “feature”. I have a feature request in to have the web reports respect the cast of the results.

vote for it!

Leave the Date results as type Date, and cast the string messages as errors, i.e.

If not exists file "/foor/bar" then error "no file" else modification date of file "/foo/bar"
1 Like

This still won’t allow him to search by date in WebReports. It will still be converted into a string in WR.

but a very simple/nice solution!

True, Web Reports does have the problem of sorting as text strings (as you note earlier). This would help in an Analysis in the console, but not in Web Reports.

For the reason that Web Reports does not sort based on date or time, I always format date and time in the following formats.
This way, string sorts will still display correctly.

q: (year of it as string & "-" & month of it as two digits as string & "-" & day_of_month of it as two digits as string) of current date
A: 2015-08-05

q: ((year of it as string & "/" & month of it as two digits & "/" & day_of_month of it as two digits) of  date(local time zone) of it & " "& (two digit hour of it as string & ":" & two digit minute of it as string & ":" & two digit second of it as string) of time (local time zone) of it) of now
A: 2015/08/05 19:33:44

That link seems dead

I think you have to have to be signed into see it.

Very interesting solution, thanks!