Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
dgreenberg
Luminary Alumni
Luminary Alumni

What the $(expansion) am I doing wrong

let vEngNumber=peek('ePartner',$(vRand),'Sampling1');

This works and returns a value like Greenberg, Dan

Where I am having trouble is

Sampling2:

Load

  eEngNumber,

  ePartner,

  [Engagement Start Date]

Resident Sampling1

where ePartner <>  $(vPartnerB);

I need to wrap the $(vPartnerB) with single quotes otherwise it's interpreted as

where ePartner <>Greenberg,Dan

what I want is

where ePartner <> 'Greenberg,Dan'

What am I doing wrong?

1 Solution

Accepted Solutions
sunny_talwar

I think this should also work:

LET vEngNumber=Chr(39) & Peek('ePartner',$(vRand),'Sampling1') & Chr(39);

and then this:

Sampling2:

Load

  eEngNumber,

  ePartner,

  [Engagement Start Date]

Resident Sampling1

where ePartner <>  $(vPartnerB);

View solution in original post

11 Replies
Anonymous
Not applicable

Maybe put the single quotes round it :

.... where ePartner <>  '$(vPartnerB)';

swuehl
MVP
MVP

Dan Greeberg wrote:

let vEngNumber=peek('ePartner',$(vRand),'Sampling1');

I need to wrap the $(vPartnerB) with single quotes otherwise it's interpreted as

where ePartner <>Greenberg,Dan

what I want is

where ePartner <> 'Greenberg,Dan'

What am I doing wrong?

Not sure if I understand your question, I think you've already answered it, wrap the dollar sign expansion in single quotes.

So this is not working for you?

sunny_talwar

I think this should also work:

LET vEngNumber=Chr(39) & Peek('ePartner',$(vRand),'Sampling1') & Chr(39);

and then this:

Sampling2:

Load

  eEngNumber,

  ePartner,

  [Engagement Start Date]

Resident Sampling1

where ePartner <>  $(vPartnerB);

dgreenberg
Luminary Alumni
Luminary Alumni
Author

Thank you Sunny. 

This worked

sunny_talwar

I would have assumed Bill's method to have worked as well. That did not work?

dgreenberg
Luminary Alumni
Luminary Alumni
Author

'$(vPartnerB)' is interpreted as '''Greenberg, Dan''' and did not work.

swuehl
MVP
MVP

Dan Greeberg wrote:

'$(vPartnerB)' is interpreted as '''Greenberg, Dan''' and did not work.

That's how the document log or debug screen logs the expanded variable? With added double quotes?

Interesting, that's against everything I've learned about how dollar sign expansion should work...

dgreenberg
Luminary Alumni
Luminary Alumni
Author

Wrapping the dollar sign expansion in single quotes does not work in my where clause  but ch(39) & $(vPartnerB) & chr(39) works

swuehl
MVP
MVP

Are you sure you've tried adding the single quotes at the right place?

LET vEngNumber=Chr(39) & Peek('ePartner',$(vRand),'Sampling1') & Chr(39);

and then this:

Sampling2:

Load

  eEngNumber,

  ePartner,

  [Engagement Start Date]

Resident Sampling1

where ePartner <>  $(vPartnerB);



Sunny's change should have had no effect at all, since variable vEngNumber is not used in the where clause.

edit: And don't take me wrong, Dan, I just want to understand why the trivial solution doesn't work...