Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
OmarBenSalem

Compare variable value to field value ..?

Hi all, stalwar1

I have a variable defined as follow:

UserID:  =subfield(osuser(),'\',1)  : since I'm using the desktop; its value is : Me

I have a table containing all user Ids and their names:

example:

Load * inline [

UT, UserName

Me, Omar Ben Salem   

Other, other user

];


What I want is to update my variable from Me to Me (Omar Ben Salem) : which is

:Subfield(Osuser(),'\',1)&' ('& UserName of UT = Subfield(Osuser(),'\',1) &')'


What I did is this:

=Subfield(Osuser(),'\',1)&'('& aggr(Only({<UT ={"$(=UserID)"}>} UserName ),UserName)&')'


It partially works but it returns :

Capture.PNG


Why it's returing the Me() thing? I just want it to return Me (Omar Ben Salem)


Hope the explanation of my problem is clearer than the thread's title

Thanks !


1 Solution

Accepted Solutions
sunny_talwar

May be try this

If(Len(Trim(aggr(Only({<UT ={"$(=UserID)"}>} UserName ),UserName))) > 0, Subfield(Osuser(),'\',1)&'('& aggr(Only({<UT ={"$(=UserID)"}>} UserName ),UserName)&')')

Or this

Aggr(Subfield(Osuser(),'\',1)&'('& Only({<UT ={"$(=UserID)"}>} UserName )&')',UserName)

View solution in original post

12 Replies
OmarBenSalem
Author

Ps: I can always transform my expression into :

= if(len(aggr(Only({<UT ={"$(=Subfield(Osuser(),'\',1))"}>} UserName ),UserName))=0,null(), Subfield(Osuser(),'\',1)&'('& aggr(Only({<UT ={"$(=Subfield(Osuser(),'\',1))"}>} UserName ),UserName)&')')


and it would work:

Capture.PNG

I just want to know why It's returning the Me() value with my first expression ?

sunny_talwar

May be try this

If(Len(Trim(aggr(Only({<UT ={"$(=UserID)"}>} UserName ),UserName))) > 0, Subfield(Osuser(),'\',1)&'('& aggr(Only({<UT ={"$(=UserID)"}>} UserName ),UserName)&')')

Or this

Aggr(Subfield(Osuser(),'\',1)&'('& Only({<UT ={"$(=UserID)"}>} UserName )&')',UserName)

OmarBenSalem
Author

Thanks Sunny, I already used the first expression; and as I told you, I wanted to know why It's returning the Me () ?

although, I'm thinking that in the expression it's clear that I just want to return to UserName where my UT = Me (the subfield thing)

sunny_talwar

Not sure how your data is, but if there are any null rows USERNAME with the way you data is connected, it will created (ME) for those rows....

OmarBenSalem
Author

Nope;

It's a test I'm performing with this inline table:

load * Inline [

UT,UserName

Me,Omar Ben Salem

Other, Other

];

Capture.PNG

tht's why I'm confused ..

sunny_talwar

What if you test with just this

load * Inline [

UT,UserName

Me,Omar Ben Salem

];

OmarBenSalem
Author

Capture.PNG

I just experienced a very weird behaviour !!!

I havn't closed my Qlik Sense Desktop since 31/11/2017:

When as a filter, I put date(today()) I have 31/11/2017 !!!

When I closed Qlik Sense et reopened it; it changed to 02/11/2017 !!

That's REAAAALLY WEIRD; mto‌ ; any explanation? Are u aware of such a thing??

OmarBenSalem
Author

+: QLIK SENSE is aware that these 2 "31/10/2017" are not the SAME ; since It does not sum them up into one field :

Capture.PNG

That's something that could affect my whole project !

sunny_talwar

May be use Today(1)... look here for explanation

today ‒ QlikView