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 write variables into .qvd

Hi,

I have 10 expressions calculated from a single table and set to 10 variables. How can I create a QVD from these?

I tried ..

v1 = sum(if(status = 'A',field1));

v2 = sum(if(status = 'B',field2));

Store v1,v2,.... into x.qvd but it didn't work may be because of using aggregate functions in the expression applied on same table.

Any alternative will be appreciated.

Thank you!

regards,

Rishu

1 Solution

Accepted Solutions
Not applicable

Re: How to write variables into .qvd

Hi,

Please check the attached sample may help you in storing the variable values into QVD and retrieving back the values from QVD and assign to the variables when you reload next time.

Cheers.

9 Replies

How to write variables into .qvd

Hi Mayank,

You need to make resident table for that.

Anand

Not applicable

How to write variables into .qvd

Hi,

I haven't test this, but you can try the following:

Table1:

load sum(if(status = 'A',field1)) as v1,

       sum(if(status = 'B',field2)) as v2,

       field3,

       field4

from ....

group by field3, field4;

Table2:

load v1,

       v2

resident Table1

store Table2 into Table2.qvd;

Hope this helps

Regards!

How to write variables into .qvd

Hi

If you dont know how to right resident table please see for variables.

v1 = sum(if(status = 'A',field1));

v2 = sum(if(status = 'B',field2));

Tab1:

Col1,

Col2,

sum(if(status = 'A',field1)) as v1,

sum(if(status = 'B',field2)) as v2,

from Data;

Tab2:

load

col1,

col2,

V1,

V2

resident Tab1;

Regards,

Anand

Not applicable

How to write variables into .qvd

Hi,

I did not checked the if formulas but focused on storing the variables.

Try this:

//---------------------------

[Temp]:
LOAD * INLINE [
F1
A
];

let v1 = 10;
let v2 = 20;

inner Join LOAD *,$(v1) as v1,$(v2) as v2 Resident [Temp];
drop Field F1;

//---------------------------

you will get a table called Temp containing 2 fields v1 & v2 with their values.

How to write variables into .qvd

Hi Mayank,

Try this code

Table1:

LOAD Agent,

     Sales,

     Sum(if(Agent = 'A',Sales)) as v1,

     Sum(if(Agent = 'B',Sales)) as v2

FROM

(ooxml, embedded labels, table is Sheet1)

group by Agent,

Calls,

Duration,

Sales;

Table2:

load

Agent,

Sales,

v1,

v2,

1 as junk

Resident Table1;

Store Table2 into Table2.qvd;

Drop table Table1;

Regards

Anand

How to write variables into .qvd

Hi Mayank,

Use above code according to your requirements and fields.

Regards,

Anand

Not applicable

Re: How to write variables into .qvd

Hi,

Please check the attached sample may help you in storing the variable values into QVD and retrieving back the values from QVD and assign to the variables when you reload next time.

Cheers.

Not applicable

How to write variables into .qvd

Thanks to all....I got it done!

regards,

Mayank

Not applicable

Re: How to write variables into .qvd

Is there any way to get back the calculated result from a variable and store it in a qvd??

for example lets say i have count(Volume) which calculates in 10 in the interface, is there any way to retrieve this number and store it on a qvd??

Community Browser