Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

AH
Contributor III

Understanding Script

Hi,

I have a code in my script like this that somebody has written previously:

If(Sales> '0' or [Sales Flag] = 'Y', 'Y', 'N') as WarrantFlag

What is this code mean?

Is it like this? if sales is greater than zero or Sales flag = Y then Y otherwise N.

If i want to us these piece of code in where clause after the load statement then how should i write the code?

Thanks,

ahmed100

Tags (1)
1 Solution

Accepted Solutions
kkkumar82
Valued Contributor III

Re: Understanding Script

I think load  .... ......     where (sales>0 or  flag='yes');  is also fine  Kiran Kumar

12 Replies
Chanty4u
Esteemed Contributor III

Re: Understanding Script

hi,

the code mens

If(sales>0

or

[sales flag]= 'yes'    the value of sales is more than " 0"  or sales flag value  is "yes"  it will returns " yes"  otherwise "No"   by that it will create a flag.

hope this helps u

AH
Contributor III

Re: Understanding Script

Hi Chanty,

Thanks for the reply.

How can i use this code in where clause in the load script?

like this:

Load

---,

---

From xyx

Where-----------(how to use the code here?)

Thanks,

ahmed100

Chanty4u
Esteemed Contributor III

Re: Understanding Script

load *,

....

......

where exists (sales>0 and/or  flag='yes');

kkkumar82
Valued Contributor III

Re: Understanding Script

I think load  .... ......     where (sales>0 or  flag='yes');  is also fine  Kiran Kumar

AH
Contributor III

Re: Understanding Script

Hi Chantu,

Is the exists functions is used when there is a table Already loaded and we are comparing the table we are currently loading?

Thanks,

ahmed100

kkkumar82
Valued Contributor III

Re: Understanding Script

Hi Ahmed,

Your are correct exists function is used to check if the value exists for previous loaded values, Is that what you want or while loading you want to check the condition then what I suggested would be fine.

Regards

Kiran Kumar

Re: Understanding Script

try this

WHERE Sales>0 or [Sales Flag]='Y'

Chanty4u
Esteemed Contributor III

Re: Understanding Script

yes..

u can try

where sales>0 and [sales flag]='yes'

MVP & Luminary
MVP & Luminary

Re: Understanding Script

HI,

If you want to filter out those rows then use below script

Data:

LOAD

*

FROM DataSource

WHERE Sales> '0' or [Sales Flag] = 'Y';


Regards,

jagan.