Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparing QVUSER to another String Variable

I have a need to compare the (QVUSER) variable against another string variable (vSomeGroup) and then set a variable (vUserGroup) to a portion of the string (vSomeGroup).

For example vSomeGroup = 22/testuser123y/testuser342t…

QVUSER =  testuser123y

In this case (QVUSER) is found in the variable (VSomeGroup)

Now I want to set the variable (vUserGroup) to the first two characters of (vSomeGroup) in this case it would be “22”

Now the issue:

When I am developing and I add the following code to the variable in the QVW it works. Of course I am setting the QVUSER manually for testing. =If(SubStringCount('$(vSomeGroup)','$(QVUSER)' )> 0, LEFT('$(vSomeGroup)',2))

When I try and publish the job and add the code below in the loader to pass the string of code to the variable it does not work. Set vUserGroup  = "=If(SubStringCount('$(vSomeGroup)','$(QVUSER)' )> 0, LEFT('$(vInsts26)',2))"

Any suggestions or advice would be greatly appreciated. Note – QVUSER is being used and is passed

Note - we are using version 8.5

3 Replies
JonnyPoole
Employee
Employee

Quick question:  if you add a text box to your dashboard with  $(QVUSER) , what does it display on the server after a publisher reload ?

Reason i ask is that there is a FUNCTION called QVuser( )  and to invoke it you need the parantheses . So instead of

'$(QVUSER)' , you would use  'QVUSER(). 


Or are you setting your own variable called QVUSER = Qvuser().


I'm a little confused... here is the function i'm referring too below (last in list)

qvuser.PNG.png

Anonymous
Not applicable
Author

I note that the Ray says he is using QV 8.5 so that was before Section Acces, so back then QVUSER may well have been System Variable.

But before my time so I cannot answer definitively.

Not applicable
Author

Thank you for the quick response.

I changed the code to use Qvuser() but it did not work, but got me pointed

in the right direction.

After multiple iterations using SubStringCount I went in a new direction

and got a working solution.

New syntax

Set vUserGroup = "=If(INDEX(vSomeGroup,UPPER(QVUSER()))> 0,

LEFT(vSomeGroup,2))"

On Thu, Sep 4, 2014 at 1:59 PM, Jonathan Poole <qcwebmaster@qlikview.com>