Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

How to differentiate between columns used at different instances?

Hi friends,

I have a student.qvd file. I have to display 2 reports. They are:

1) Student with id>150

2) Students whose address is not equal to India

I have written the following code:

report1:

load   student.name,

          student.address,

          student.id

FROM

(qvd) where student.id>150;

report2:

load   student.name,

          student.address,

          student.id

FROM

(qvd) where student.address<>'India';

Now, how i have to differentiate between student names between 2 reports?

Any help is greatly appreciated?

1 Solution

Accepted Solutions
Not applicable

Re: How to differentiate between columns used at different instances?

Hi,

You could give the first query as

load   student.name as Student1,

          student.address,

          student.id

FROM

(qvd) where student.id>150;

and second as

load   student.name as Student2

          student.address,

          student.id

FROM

(qvd) where student.address<>'India';

Then, in one chart, populate Student1 and Student2 in the other.

Regards,

Anju

8 Replies
nirav_bhimani
Contributor III

Re: How to differentiate between columns used at different instances?

HI,

Try this Code.

report1:

load   student.name,

          student.address,

          student.id,

          'Top150' as Source     

FROM

(qvd) where student.id>150;

report2:

load   student.name,

          student.address,

          student.id,

           'Address' as Source 

FROM

(qvd) where student.address<>'India';

On the basis of Source you can differentiate.

Regards,

Nirav Bhimani

Re: How to differentiate between columns used at different instances?

Load all the data into one table and do the filtering in the reports. If you have QV11 this is very easy by defining Alternate States for the different charts.


talk is cheap, supply exceeds demand
Not applicable

Re: How to differentiate between columns used at different instances?

Thanks Nirav for your reply,

But i don't want to display 'Source' in the report. Moreover, i want to display  2 different reports 

Not applicable

Re: How to differentiate between columns used at different instances?

Hi Gysbert, i am very new to QV and yes, my version is QV11.

Can you please elaborate your answer?

Not applicable

Re: How to differentiate between columns used at different instances?

Hi,

You could give the first query as

load   student.name as Student1,

          student.address,

          student.id

FROM

(qvd) where student.id>150;

and second as

load   student.name as Student2

          student.address,

          student.id

FROM

(qvd) where student.address<>'India';

Then, in one chart, populate Student1 and Student2 in the other.

Regards,

Anju

nirav_bhimani
Contributor III

Re: How to differentiate between columns used at different instances?

You can Write Set Expression as,

Count ( {<Source= {'Top150'} >} name )  // For Report1

Count ( {<Source= {'Address'} >} name )  // For Report2

No need to display in front end.

Regards,

Nirav Bhimani

Not applicable

Re: How to differentiate between columns used at different instances?

Thanks Anju. It worked well.

Similarly do i have to do for address and id?

Can't i define the entire "load block" with any variable?

Not applicable

Re: How to differentiate between columns used at different instances?

No, you don't have to do it for address and id .....it will automatically populate the correct address and id.

We can't define an entire block with a Load variable. But, I guess qlikview somehow 'remembers' which query is responsible for a variable

Regards,

Anju

Community Browser