Modifying Query dropdown on Worker Report

artusod's picture

Hi,

Which template would I modify to change the contents of the Query dropdown on the Worker Report page?

Thanks,

Dan

David Falcon's picture

You shouldn't have to customize the template. You should be able to go to Incidents > Queries and create/disable/remove queries that you want to appear or not appear.

artusod's picture

Hi,

Thanks for the reply. I should have worded it differently. I want to restrict certain queries from being seen by certain people.



In any case, I found the template and can control what queries are visible by creating my own dataset based on who the logged on worker is.



Dan

dclaxton's picture

Can you share more information about this? I'm interested on how to do the same.

DC

artusod's picture

Hi,

I did not end up implementing this in production. Our lab is down right now, but when it's back up, I'll post what I did do on the lab box.



Dan

artusod's picture

Hi,

Here's what I had so far. I think this method will only work if you have one or two 'groups' that you need to compartmentalize, otherwise the security mangement will be just too much work.



The template to modify is WorkerReport.ascx. Of course you should follow the guidelines on custromizations in that you make a copy of this file and modify that, not the original. This is outlined in the product documentation.



Anyway... The file originally contains this line:



DataStore("Queries") = DataStore("CurrentWorker").AllWorkerQueriesWithNoPrompts()



THis will bring back all queries.



I have modified it with these lines:



If CurrentWorker.worker_id = 60 Then

DataStore("Queries") = New ListDataSet("Select id As worker_query_id, [name] as worker_query_name from worker_query where id Not In (30,33,35,37,39)")

Else

DataStore("Queries") = DataStore("CurrentWorker").AllWorkerQueriesWithNoPrompts()

End If



All statements must be on their own line! The spacing may be mangled here in this small window!



That's as far as I got. Worker id 60 represent me, so I got only a subset of the available queries. You can see that it would be a lot of work to implement your own security scheme.



You should probably use a Select Case instead of If...Then...Else

The idea being you check the current worker id and show that person only the queries that you want them to see. To modify, you just enter the query id's of the queries that you DO NOT want the person to see in the brackets of the above sql statement. You can see the id's in the table: worker_query



Dan