Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

where clause

Hi,

I am trying to load values where a year is matching, but instead of loading values where a year is matching, the code is assigning the year value of one to another and thus loading everything.

the code I am using is:

[ExistingMonths]:

  LOAD DISTINCT

  [Month]

  FROM

  [ExistingMonths.qvd]

  (qvd)

  WHERE

  [Month] = '$(vNewMonth)';

  LET vMonth = PEEK('Month',0);

The vNewMonth variable is taking value from the source file, which is correct.

Before the where statement values are different, but after the where statement, [Month] field takes the value of vNewMonth variable and hence the vMonth variable as well.

Any help?

Labels (1)
4 Replies
gandalfgray
Specialist II
Specialist II

Hi Y B

I am not sure what you expect to get...

It is obvious that if you LOAD [Month] from a qvd and have a WHERE clause stating that [Month] = '$(vNewMonth)'

the [Month] field can only have the same value as vNewMonth. (Or the table will be empty if no matching [Month] is found in the qvd.

/gg

Not applicable
Author

can u come up with clear explination ,

there is lot of confusion

what is the value of    vnewmonth?

Not applicable
Author

no, but my source file doesn't have that month. So I am expecting no rows and hence vMonth = ' ' (Null value).

However, the where clause is assigning the new month values to existing ones and loading everything.

Even I am confused.

anbu1984
Master III
Master III

Can you post the entire script