Custom Web Report does not run after save

I have a custom web report written in HTML/JavaScript, and it runs just fine when clicking preview. The issue happens when I save the report and reload the page. Something fails when evaluating the Relevance statement that was previously working.

I thought something may have been changing in encoding or line endings. I’ve run a diff on the saved version in Web Reports and a copy on my machine, and there is no difference.

I don’t even have to change anything in the code. Once I hit “preview” with the previously not working code, it just starts working again.

Thanks in advance

@snorman, I would recommend bumping up the log-level for BESWebReports and look for specific error messages when running the report in question.

For additional details on logging for WebReports, please click here.

Thanks for the prompt reply!

I’m at a rather large organization without admin access to anything. I would have to track down people and file paper work and such. I was thinking there was some kind of JS troubleshoot I could do on my end.

When using a try catch block around the EvaluateRelevance call, I get the error:
“Singular Expression refers to nonexistent object”

Is there something I need to import in my JS, or setup before I evaluate the relevance expression?

If not I’ll trace it down with my admin.

Thanks again

That’s probably a problem with the relevance statement itself. Can you share?

With a “Singular Expression refers to nonexistent”, it may be that one of the properties you are retrieving does not have a value on some machine(s). A common enough thing is a computer that has not yet reported its name. You can usually trap these with the pipe operator ( | ), as in

(name of it | "Name not reported") of bes computers
1 Like

I am able to get the name of the computer and its id. My report has two text boxes that the user enters the hostname for two different machines to compare configurations of. I lookup the hostname to get the id of the computers. And then use the id in this expression

(name of it, last report time of it, operating system of it, cpu of it, value of result from (bes property "RAM") of it, value of result from (bes property "Hardware Model") of it, value of result from (bes property "System Manufacturer") of it, value of result from (bes property "Default_Java") of it) of bes computer <computer id>

This expression evaluates just fine after I click the preview button, but not on the initial load of the page.

@JasonWalker , after looking a little more into it, I think the initial id call was the issue.

EvaluateRelevance("ids of bes computers whose (name of it = \"" + hosts[i] +"\")")

I was just taking the first element of the array this returned where hosts is the array of user input hosts. But when changing which id I took from this array it worked properly.

This solved my issue. I’ll be more careful about which ids I use.

Thanks!

1 Like