Referencing a tag to get the username - Vision [SOLVED]

Hi I'm trying to get the username to a tag but I can't seem to get the value, its either null or bad/not found.

This is on vision and I'm using a query tag and the where clause for it needs the value of whoever is logged in ({[System]Client/User/Username}), how would be the best way to get this?

I can get the username if I use the Vision Client Tag (Expression) and then add another Vision Client Tag (SQL) for the query that I need then reference that Expression Client tag but I get this error


I feel like this should be really easy and basic but I'm going in circles lol

The gateway runs independent of any client--there's no one "logged in" to the gateway. And that is where query and expression tags are computed.

You shouldn't be doing user-dependent things in gateway tags anyways--what do you expect to happen when a second client logs in at the same time? Or no user is logged in at all?

Use custom properties in window or components or templates for specific locations, and use Vision Client tags for truly per-client values. (In Perspective, you would use session custom properties.)

Using gateway tags for per-client UI purposes is an anti-pattern.

I'm not using any gateway tag. I simply just want to add a tag (Vision or Client tag) that can see whoever is logged in by using the provided username tag from the system > client tags folder.

Can you show a more complete screenshot of what you're attempting/where you're writing this SQL query?

Our client has requested that they want to be able to change their own password on their first login.

What I did for that is I have created another window and used the user management component. And then I added a column on our users database that determines if the user is signing in for the first time or not.

If the user has already changed the password the client startup script will just open the main windows

If the user is only logging in for the first time I have added a query tag that finds the column i added on our db (checking if that user is logging in for the first time or not), this query tag im reading on the client startup script using system function.

And where I'm stuck is that query tag.

I'm trying to do just a simple select col from table where username = system/client/username

Hope that clears it up

That seems reasonable - but can you show the exact syntax of how you're inserting the system tag into your client tag SQL query?

I'm not inserting anything, I'm mainly just reading. This is on the client startup script

if"[default]def_pwd").value == 0:
if system.gui.confirm("Do you want to change your password?"):
window = system.nav.openWindow('User_Update_Pwd')
window.getRootContainer().getComponent('User Management').componentEnabled = 1

  	window.getRootContainer().getComponent('User Management').componentEnabled = 0

elif"[default]def_pwd").value == 1:

window = system.nav.openWindow('Windows/Room')

The query tag, outputs 1/0

SELECT def_pwd FROM users WHERE username = "{[System]Client/User/Username}"


Is this query tag in the gateway tags (in a tag provider)? If so, that is gateway scope and cannot access Vision's client information. AT ALL.

Make a query tag in Vision's Client Tags, not in a gateway tag provider.

I was going to say I've done that already and while I was looking at the vision query tag, I had it right all along. The username I had logged in on the designer was from our production user db and the data im getting is from a development user db (with different users from the prod) so it was showing the error because there was no user in that database. It's always the simplest things. Lol. Thank you!