Ernst wrote:"It shouldn't take too much effort to get it working correctly with reports also."
OK I like that bit, is it something I could do, or would it need JIWA to change the way it runs reports?
I don't think we'd need Jiwa to be changed at all - the SQL predicate function (ufn_JIWA_SecurityPredicateDebtors_result) would have to change, though.
A slight alteration to what I described in the approach, however - When a report is run a new connection is established by Crystal Reports to the SQL Server - so each report potentially has a different SPID.
But the report processes have the same hostprocess (Client Process ID) to the Jiwa application - so you can find the SPID of the reports by linking them via the sys.sysprocesses.hostprocess value.
So the good news is all you should need to change is the ufn_JIWA_SecurityPredicateDebtors_result function to consider sys.sysprocesses.SPID's with the same sys.sysprocesses.hostprocess as @@SPID).
Without dedicating some time to this I can't be absolutely sure this will work - and you might encounter issues with permissions to sys.sysprocesses - it depends on your environment.


