Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
ivan_will
Partner - Creator II
Partner - Creator II

get the USERNAME in the MACRO module

Hi,

Using section access and want to take the username from the table created by the section access. Want to do that in the macro module and using if statement

example if vUsername='David' .... bla bla ...

Thanks in advance!

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

That`s how you can get the content.

set v = ActiveDocument.Variables("Variable1")
msgbox(v.GetContent.String)

If you use authenticated user that will probably be DOMAIN\USER (you can check that with the new macro).

After you set the value you can check it on the variable overview (settings menu)

View solution in original post

3 Replies
erichshiino
Partner - Master
Partner - Master

Use this:

If you want the authenticated user (NTNAME on section access you use the first line

Use the second if you want to get the user name (when you use user name and password)

sub setUser

set v = ActiveDocument.GetVariable("vUser") v.SetContent ActiveDocument.GetLayout.AuthenticatedUser,true

' v.SetContent ActiveDocument.GetLayout.QvUser,true

end sub

ivan_will
Partner - Creator II
Partner - Creator II
Author

I'm still having problems!

sub setUser

set vMacroUser = ActiveDocument.GetVariable("vUser")

vMacroUser .SetContent ActiveDocument.GetLayout.AuthenticatedUser,true

end sub

sub PlaySound

If vMacroUser = "????" Then

ActiveDocument.PlaySound "C:\WINDOWS\Media\tada.wav"

End If



it dont play the sound ! Don't know why ?! and could you please tell how to check what value has the variables in the macros

Thanks

erichshiino
Partner - Master
Partner - Master

That`s how you can get the content.

set v = ActiveDocument.Variables("Variable1")
msgbox(v.GetContent.String)

If you use authenticated user that will probably be DOMAIN\USER (you can check that with the new macro).

After you set the value you can check it on the variable overview (settings menu)