[hfe_template id='1680'] Making Reports Show Viewer Specific Information | HALO

Making Reports Show Viewer Specific Information

How to use the built in pseudo-variables within halo to match viewers to the data on a report.

Within the reporting suite in halo there are pseudo-variables that you are able to match the date on the report to, some being $agentid,$userid, $siteid, $clientid, and $invoiceid.


$agentid allows you to make internal reports only match to the viewing agent. $userid, $siteid and $clientid are used so that users logging into the portal can only view values on reports in the end user portal which are related to themselves or their site site or client.


$Invoiceid is different from the ones above as instead of relating to the recipient of the report, it instead will only invoice relevant information in the case that you create a report that is inserted into an invoice via the PDF templates.



For an example, say that you have a report counting how many tickets have been cleared by each agent, and you are using the column ClearWhoInt to find the agents for you, then you would be able to add the following to the code:


where clearwhoint = $agentid


This will make the viewing agent be able to see their count of closed tickets but non of the other agents in their organisation.

Using the variables allow for the report information to be dynamic based on the specified variable used in the SQL. For example If you are looking to create customer specific lookups (such as a lookup of a customer’s sites) you can use the $-userid field in the dynamic SQL query. If you structure the query in a certain way this will then work in the same way the $-clientid variable works in customer reporting.

The bold part works like $-clientid:

select distinct uid as [id],

uusername as [display]

from users

left join site on usite = ssitenum

left join area on sarea = aarea

where aarea = (

select aarea

from users

left join site on usite = ssitenum

left join area on sarea = aarea

where uid = $userid) and uusername not like '%general user%' and uinactive=0

[hfe_template id='2416']