Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Display initial sheet based on User profile?

Hello,

I have a question in displaying startup sheet based on user profile.

For Ex. Qlikview application has 5 sheets as sheet1, sheet2, ..sheet5. when UserA opens Qlkiview application he/she should login to default Sheet2, for UserB should login to Sheet3 and so on. After that users does not have any restriction accessing sheet.

How can I implement this functionality. Any ideas would be appreciated.

Thanks, Siva

10 Replies
markmccoid
Partner - Creator II
Partner - Creator II

Hi,

I'm not sure exactly what you are looking for, but here are some general suggestions that might help.

To find out who is logged in you can use the following functions

OSUser() - which gives the NT login or

QVUser() - Returns a string containing the name of the current QlikView user as entered in a section access.

If you only want certain users to see certain sheets you can use these functions combined with macros and the Show Sheet /Conditional field in sheet properties to show and not show certain sheets.

If you just want a certain sheet to be active upon login and not hide the other sheets, you could create a document bookmark for each group of users that is a layout only bookmark with the desired sheet active. Then on login, either throuh section access or via a macro set to run on open of the QVW to set the appropriate name of the bookmark and then recall the bookmark.

Thanks,

Mark

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

This can be implemented via a simple macro tied to the OnOpen event. You need to associate initial Sheets with users, then link to the User info in Section access, and finally write a macro that would read the available value in the "Initial Sheet" field and open that sheet.

Another way could be using Layout Bookmarks, that you could associate with users. Then the macro would recall a bookmark.

good luck!

Oleg

Not applicable
Author

Thank you Mark & Oleg for the quick response.

I creates Section Access and linked Document Trigger OnOpen to simple macro that opens a particular sheet. I would need to enhance this macro to use QVUser() with Scetion Access. Any hint to expand this macro.

The problem here is, I am not a macro guy. I need to learn writing macros. Would you please suggest any Qlikview document and/or link to document for me to read.

Thanks, Siva

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

For starters, look at the "QlikView Automation Guide" that's installed as a part of the "Complete" installation in a folder

C:\Program Files\QlikView\Documentation

Then, in the same folder, there is a QVW document called "APIGuide" that describes all various APIs that you can use.

Finally, look under "Share Qlikviews" section of this website - there are numerous examples there.

good luck!

Oleg

markmccoid
Partner - Creator II
Partner - Creator II

Yes, get the APIGuide.QVW it is an invaluable resource when writing macros.

Here is a simple example to get you started

I chose to store the OSUser in a variable called vOSUser. So I just create a variable with the definition of =OSUser()


sub GetOSUser
set v = ActiveDocument.Variables("vOSUser")
userx = v.GetContent.String
msgbox userx
'-Some sort of IF statement based on OSUser
ActiveDocument.ActivateSheet 2
end sub


Thanks,

Mark

Not applicable
Author

I have a slightly different issue that stems off of this one. I initially was trying to use a macro to set a variable to the value of QVUSER(). It appeared that I couldn't use the macro with the AJAX client, at which point I realized I could just use QVUSER() in my expressions.

The problem I'm having now is that QVUSER() doesn't seem to be valid within set analysis. Here's one of the expressions I'm using:

=COUNT({$ <Status = {'X'}, User = {QVUSER()}> } ID )

I'm using a similar expression in an IF statement in the same app. Here's that expression: if(QVUSER() = User and Type = 'S', Name) I use this expression on a dimension and it works as expected. When I try to use QVUSER() in set analysis I get a syntax error and a null result.

Can I use this function in set analysis? If not, is there an alternative to get the value of the logged in user to pass into a set analysis modifier?

Thanks

Jim

markmccoid
Partner - Creator II
Partner - Creator II

Hi,

You need to use dollar sign expansion on the function as follows:

COUNT({$ <Status = {'X'}, User = {$(=QVUSER())}> } ID )

Hope this helps.

Mark

Not applicable
Author

Thanks, Mark. I must've tried a half dozen other variations on the syntax, including dollar expansion, but not this one. My app is working.

Jim

Not applicable
Author

Hi Jim,

I have the similar type of issue.

Will you please send me the macro code which is working with you?

If possible will please you send me the QVW file?

Thanks & Regards,

Mahasweta