Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, in the company we use Active Directory, so users appear as UserID. What is an efficient way to display something like 'Hello Miguel', for example, on a dashboard sheet? I used INLINE but I can't find the function that retrieves the values from the Name column and associates it with the UserID of the logged-in session. Can you help me? Thanks in advance.
Hi Miguel,
drop this in your load scripts as "User Table":
LET vUser = right(OSUser(),10); // edit this to match your AD structure
LIB CONNECT TO 'monitor_apps_REST_user_condensed';
User:
Load
userDirectory & '\' & userId AS UserId,
[name] AS [User Name],
userDirectory as [User Directory]
Where userId=$(vUser)
;
SQL SELECT
"userId",
"userDirectory",
"name"
FROM JSON (wrap on) "root"
;
then add this: 'Welcome User: '&' '&[User Name]
or this: 'Welcome User: '&' '&SubField([User Name],',',-1)
to the sheet.
Cheers!
OSUser() is typically the easiest one on the front end. It'll typically return the domain as well, so you may need to use something like Mid(OSUser(),6,9999) for example if your domain is five characters long.
Hi Miguel,
drop this in your load scripts as "User Table":
LET vUser = right(OSUser(),10); // edit this to match your AD structure
LIB CONNECT TO 'monitor_apps_REST_user_condensed';
User:
Load
userDirectory & '\' & userId AS UserId,
[name] AS [User Name],
userDirectory as [User Directory]
Where userId=$(vUser)
;
SQL SELECT
"userId",
"userDirectory",
"name"
FROM JSON (wrap on) "root"
;
then add this: 'Welcome User: '&' '&[User Name]
or this: 'Welcome User: '&' '&SubField([User Name],',',-1)
to the sheet.
Cheers!
'Hello '&Capitalize(SubField(OSUser(), '=', -1))