Subroutines or Functions

(imported topic written by RichB91)

I am used to relying heavily on subroutines and loops. Two structures that I’m not readily finding in BigFix.

Due to a requirement for

very

verbose logging of just about every Action of every Task of every Baseline, and the length of code to cast the date-time into the format we’re using, I’m repeating over 300 characters of code several times in every task.

Is there a way to put this in to some form of subroutine or function call?

Example:

The format of the lines of our log entries are

yyyy-mm-dd HH:mm:ss custom-text

.

The code we’re using to accomplish this is:

appendfile {((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} sample-text

Can this code be simplified?

Can we call the same code multiple times rather than hard-coding these commands every time?

(imported comment written by NoahSalzman)

There is no current feature that allows for “a stored Relevance function”. It’s a common discussion topic around the office… but don’t hold your breath.

Date/time parsing is ugly looking, as you noticed. There are a couple place holder bugs/feature-requests that would go a long way to addressing your Relevance statement but, once again, not high on the list since “while convoluted, it does work just fine.”

As far as the date parsing, this is an alternative, not much shorter though:

(year of it as string & “-” & month of it as two digits & “-” & day_of_month of it as string) of current date & " " & preceding text of first " " of (current time_of_day as string)

(imported comment written by RichB91)

Thank you. Not the answer I was hoping for. But this is still a helpful answer. At least I now know I can stop spending time looking for a solution that doesn’t…yet…exist.

-RichB