Scheduling archive of custom reports, Preprocessing vs Javascript

(imported topic written by SystemAdmin)

I’m doing some testing with scheduling archiving of custom reports, and ran into a behavior that I hadn’t seen documented that I wanted to follow up on (perhaps I’m looking in the wrong documentation set). If I use preprocessing for the relevance queries (stringResult=<?relevance "script"?>), the archived results display correctly. If I use the javascript method (stringResult=EvaluateRelevance(“script”)), the archived results don’t display. In both cases if I look directly at the custom report, the data displays fine.

I’m presuming this behavior is due to <?relevance ?> being evaluated on the server side, while EvaluateRelevance(“relevancescript”) is evaluated on the client side. I usually prefer to use EvaluateRelevance, mainly because I’m building tables involving data from multiple analyses. I can build the relevance statement into a loop in the Javascript and substitute in variable elements (such as Analyses Name) using an array to simplify the custom report. If I need to change the number of analyses being looked at, I can just add to (or modify) the array of variable elements. But since our user base would like to keep the history of this data, I’d like to try to scheduling a regular archive of the data.

If it is necessary to use <?relevance "script"?> to have archive results displayed correctly, is there a convenient way to include variables into the relevance using this method? Or am I missing something about archiving custom reports containing EvaluateRelevance javascript, and there is a way to make archiving work with reports containing EvaluateRelevance?

(imported comment written by BenKus)

Hi AndyS,

You are dead-on with your analysis.

‘EvaluateRelevance’ in a custom report is javascript that is evaluated in the browser and thus does not evaluate properly when archived or emailed. ‘<?relevance ... ?>’ is pre-processed and thus will work fine for emailing/archiving.

We are investigating including a more extensive “server-side-scripting” capability in future BES versions which will solve this core issue, but until then, you will need to use “<?Relevance ... ?>” if you intend to archive/email.


(imported comment written by SystemAdmin)

Thank you for the prompt reply Ben. Since there is no way (at present) to use Archive/Email with the EvaluateRelevance function, is there a way to put variable elements into <?relevance ?> statements? My understanding is that there isn’t, but I want to make sure there isn’t a workaround I’m unaware of, perhaps using the javascript array relevance call.

For example : the following relevance totals the number of errors for a given analyses (I realize I should be using ID instead of name since the name isn’t guaranteed to be unique, as well as confirming that the analyses flag is set, but I’m trying to keep the example simple.)

number of (results of (properties of (bes fixlets whose (name of it ="")))) whose (error flag of it = TRUE)

If I have a list of analyses names, I can build the string of the relevance to call with a for loop by substituting the analysis name, and then I just need to change the list of names to change the results.

AnalysesNames[0]=‘name 1’

AnalysesNames[1]=‘name 2’

AnalysesNames[2]=‘name 3’

checkErrorsBegin = number of (results of (properties of (bes fixlets whose (name of it ="

checkErrorsEnd = ")))) whose (error flag of it = TRUE)

for (i=1;i<=ApplicationNames.length;i++){

RelevanceToCall=checkErrorsBegin + ApplicationNames


  • checkErrorsEnd;



= EvaluateRelevance(RelevanceToCall);


What I’m actually working on is more complex than this example (this is a simplified example of one row in a table being constructed, and there are multiple lists of analyses names), but this example gets the idea across.

So given this example, is their a functional equivilent for using a list of names like this in <?relevance ?> statements?

Or is the only functional equivilent to explicitly list each full relevance statement, like so:

Errors[0] = <?relevance number of (results of (properties of (bes fixlets whose (name of it ="name 1")))) whose (error flag of it = TRUE)?>

Errors[1] = <?relevance number of (results of (properties of (bes fixlets whose (name of it ="name 2")))) whose (error flag of it = TRUE)?>

Errors[2] = <?relevance number of (results of (properties of (bes fixlets whose (name of it ="name 3")))) whose (error flag of it = TRUE)?>

Mainly I’m trying to avoid entering the full relevance each time, since when I’m in the case of dozens of analyses each with a relevance that’s multiple lines long, it’s going to be hard to read and substantially increase the possibility that I’ll make a mistake with one of the individual relevance calls.

Thanks again,


(imported comment written by BenKus)

Hey Andy,

You are correct… all relevance must be evaluated before the page loads and so anything you are doing to construct relevance statements will not work with archived reports… So re-entering the relevance for each array element would be your only choice in this case…

The best thing I can think of might be to write a separate small script to generate your relevance to avoid making a simple copy/paste mistake… Not exactly convenient, but hopefully it will work for you.


(imported comment written by jessewk)

Hi Andy,

Here’s an idea for you. Not sure if you’ll like it, but you might find it easier:

<?relevance javascript array "AnalysisErrors" of ( name of it & "," & ( it as string ) of number of results whose ( error flag of it ) of properties of it ) of ( bes fixlets whose ( analysis flag of it AND ( name of it = "BigFix Firewall - Firewall Policies" OR name of it = "BigFix AntiVirus: Aggregate Statistics" OR name of it = "Adobe Product Detection (Windows)" ) ) ) ?>

That will give you an array to cycle through. For each string in the array the number of errors will follow the last comma, and the name of the analysis will be everything preceding the last comma.

To add an analysis, just paste in a new OR clause at the end.

On a side note, whenever possible in custom reports you should avoid repeated calls to EvaluateRelevance. In web reports each EvaluateRelevance call requires a round trip to the server, which typically entails at least half a second of latency. You don’t want to do that repeatedly inside a loop.


(imported comment written by SystemAdmin)

Thanks Jesse, that does help. I hadn’t thought about that approach to reducing the relevance calls needed.