Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Author

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.

View solution in original post

9 Replies
its_anandrjs

Hi Mayank,

You need to make resident table for that.

Anand

Not applicable
Author

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!

its_anandrjs

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
Author

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.

its_anandrjs

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

its_anandrjs

Hi Mayank,

Use above code according to your requirements and fields.

Regards,

Anand

Not applicable
Author

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
Author

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

regards,

Mayank

Not applicable
Author

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