9 Replies Latest reply: Apr 9, 2014 12:13 PM by Nikolaos Kavroulakis

# 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

• ###### How to write variables into .qvd

Hi Mayank,

You need to make resident table for that.

Anand

• ###### 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:

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:

col1,

col2,

V1,

V2

resident Tab1;

Regards,

Anand

• ###### How to write variables into .qvd

Hi,

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

Try this:

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

[Temp]:
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:

Sales,

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

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

FROM

[D:\Data\TestData.xlsx]

(ooxml, embedded labels, table is Sheet1)

group by Agent,

Calls,

Duration,

Sales;

Table2:

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

• ###### 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.

• ###### 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??

• ###### How to write variables into .qvd

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

regards,

Mayank