Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I want to limit the display of tabs in a QlikView based on an individual users' security. Basically, I have a table which resembles the following . . .
User Access
DomainName\Joe-Sales 1
DomainName\Joe-Inventory 0
DomainName\Fred-Sales 0
DomainName\Fred-Inventory 1
DomainName\Sally-Sales 0
DomainName\Sally-Inventory 1
On the actual tabs, within the sheet properties, I set the Show Sheet to be conditional with the following expression (i.e. for the Sales tabs) . . .
=$(vShowSalesSheets)
I then have the following Macro defined on the OnOpen trigger . . .
Sub SetSecurity
' Get the current domain name\user ID.
vUserID = ActiveDocument.Evaluate("OSUser()")
' Set the ID of the security table.
Set vSecurityTableID = ActiveDocument.GetSheetObject( "TB07" )
' Set up the sales key, find it in the security table, retrieve the access and set the show sales sheets variable.
vUserIDQlikView = vUserID&"-Sales"
For vRowIter = 0 to vSecurityTableID.GetRowCount-1
Set vCell = vSecurityTableID.GetCell(vRowIter,0)
If UCase(vCell.Text) = UCase(vUserIDQlikView) Then
Set vAccess = vSecurityTableID.GetCell(vRowIter,1)
ActiveDocument.Variables("vShowSalesSheets").SetContent vAccess.Text, True
End if
Next
' Set up the inventory key, find it in the security table, retrieve the access and set the show inventory sheets variable.
vUerIDQlikView = vUserID&"-Operation"
For vRowIter = 0 to vSecurityTableID.GetRowCount-1
Set vCell = vSecurityTableID.GetCell(vRowIter,0)
If UCase(vCell.Text) = UCase(vUserIDQlikView) Then
Set vAccess = vSecurityTableID.GetCell(vRowIter,1)
ActiveDocument.Variables("vShowInventoryheets").SetContent vAccess.Text, True
End if
Next
End Sub
This works OK when I run it on my PC but when I copy it to the AccessPoint and run it from there it doesn't run. Any ideas? I've tried different settings of the 'Requested Module Security' and 'Current Local Security' from within the Edit Module window but can't seem to get it to work.
Is this because Macros can't be run from the server. If so, how can I achieve what I want?
Geoff.