Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sharing Variables bewteen two qvw

Is this possible? The scenario is like this:

the 2nd QVW looks like this:

 

LOAD

PosId,
TradeId,
Trade
FROM
[Trade$(TheVariable).qvd] (qvd);

I have 100s of these QVDs with names like TradeAcct1.qvd, TradeAcct2.qvd etc.

The first QVW will show the user a list of the accounts, that is:

Acct1

Acct2

...

Acct100, etc

Depending on which account the user clicks, the value 'Acct1', 'Acct2 etc will be passed to the 2nd QVW's TheVariable variable which should then load itself using the respective qvd file.

The reason for doing this is that the combined size of all the TradeAcctXXX.qvd is too large and can't be loaded in one single qvw. This way, I will only ever load the daat needed by the user to see.

Any pointer towards the right direction will be appreciated.

8 Replies
Gysbert_Wassenaar

You can make selections in one document, open a second document and transfer the selections to the second document with an Open Qlikview Document action. You can then use the selections in the second document to set a variable and do a reload.


talk is cheap, supply exceeds demand
Not applicable
Author

Did what you said:

1. Passed the selection of a field called 'Acct' to the second document (That works as I am displaying the selection in a text box). Possible values are 1 or 2). The opening of the 2nd doc happens on a button click

2. On 'Open DOcument' trigger, added 'Set variable' action and set value as '=Acct'

3. Added 'reload' as the 2nd action

4. So expected it to load Trade1.qvd when from first doc Acct 1 is selected and Trade2.qvd when Acct 2 is selected

5. State is passed on from 1st doc to the second

However, even though I can see right 'Acct' value passed bewteen the docs, the 2nd qvw fails to set the variable properly and can not access the datafile that I want it to load.

Where am I going wrong?

(I can't attach the docs as our company policy doesn't allow it. However, I can mail it if you give me an email id)

Not applicable
Author

Did what you said:

1. Passed the selection of a field called 'Acct' to the second document (That works as I am displaying the selection in a text box). Possible values are 1 or 2). The opening of the 2nd doc happens on a button click

2. On 'Open DOcument' trigger, added 'Set variable' action and set value as '=Acct'

3. Added 'reload' as the 2nd action

4. So expected it to load Trade1.qvd when from first doc Acct 1 is selected and Trade2.qvd when Acct 2 is selected

5. State is passed on from 1st doc to the second

However, even though I can see right 'Acct' value passed bewteen the docs, the 2nd qvw fails to set the variable properly and can not access the datafile that I want it to load.

Where am I going wrong?

(I can't attach the docs as our company policy doesn't allow it. However, I can mail it if you give me an email id)

Not applicable
Author

Basically, what I want is being able to load a qvd in my qvw dynamically depending on what had been selected in another document.

So far it seems this is quite undoable. While loading, the target document has no sense of what had been passed to it.

Any one has to face such a scenario?

Given below is a flow of the process as I need.

  1. Open Doc1
  2. Doc1 shows this:
AcctTotal Transaction
150000000
260000000

3.     User selects Account 1

4. This should open a 2nd doc which should show detail transactions of account 1 that makes up the total 50,000,000

I know this could be achieved in various ways, but the issue is that the detail transactions of all the accounts together is few hundred GB, so it will not work very well having all those data loaded in a single qvw then applying a filter. So what I wanted is to have smaller QVDs -- one each for each account - with names like TranAcct1.qvd etc -- all of which would have the same structure. Then use a generic 2nd doc within which I can load the required QVD depending on what the user selected in Doc1.

So, something like

IF <user select account 1 in Doc1>

then set FileNum=1;

ELSEIF <user select account 2 in Doc1>

then set FileNum=2;

LOAD * from TranAcct$(FileNum).qvd (qvd);

But it seems the opening script of Doc2 has no knowledge of what passed to it from Doc1.

Would be grateful if anyone can show how it could be done.

Gysbert_Wassenaar

I don't understand why you need two documents. Can't you use one document and only load the file you need based on the selections you make? See attached example.

As to why your OnOpen trigger doesn't work. I think it's because that trigger fires before the selections are transferred. You'll need an extra action to trigger setting the variable and the reload.

If you do need two documents you could try writing the variable with the selections to a text file that's referenced in the second document with an include statemen $(Include=SomeFile); and then reload it with the OnOpen trigger. I don't think this will work on Qlikview Server though. A number of triggers are disabled in the server environment.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Hi Gysbert,

  how created a varibles with out using any function.

Can you please tel me.

REGARDS

SHAIK

Not applicable
Author

Gysbert, Using just one doc would mean that once user selects a particular account, I have to reload the whole doc containing both the account data and the transaction data. Also, not sure how the doc will load at the beginning where the transaction file names are unknown.

I can't open the qvw you attached as my personal edition QV doesn't allow it. Will you pl copy-paste the loading code?

Gysbert_Wassenaar

In the UI the variable vYears is set by a Set Variable action for the OnSelect trigger of the Year field using =concat(distinct Year,',') as expression to set the value of the variable. A button is used to execute a partial reload so only the data from the choosen years is loaded. The other reference data is only loaded with a full reload.

This is the script:

Table1:

REPLACE ONLY  LOAD * Inline [Region, SalesPerson, Product, Sales, Transaction Date, Year ];

for each vYear in $(vYears)

             ADD ONLY LOAD

                  Region,

         SalesPerson,

                  Product,

                  Sales,

         [Transaction Date],

                  Year([Transaction Date]) as Year

              FROM salestodate$(vYear).xls

     biff, embedded labels, table is [Sheet1$]);

next

QUALIFY * ;

// reference data for comparison

T:

LOAD [Transaction Date] as TransactionDate,

     Year([Transaction Date]) as Year,

     QuarterName([Transaction Date]) as Quarter,

     Month([Transaction Date]) as Month,

     MonthName([Transaction Date]) as MonthName,

     MonthEnd([Transaction Date]) as MonthEnd,

     Date(MonthName([Transaction Date]),'MMMM YYYY') as FormattedMonthName,

     Date(MonthEnd([Transaction Date]),'MMMM YYYY') as FormattedMonthEnd,

     Week([Transaction Date]) as WeekNumber,

     WeekDay([Transaction Date]) as WeekDay,

     Region,

     SalesPerson,

     Product,

     Sales,

     AutoNumber(Product&SalesPerson&Region) as Key

FROM

[salestodate.xls]

(biff, embedded labels, table is Sheet1$);

UNQUALIFY * ;

Years:

load distinct T.Year as Year Resident T;


talk is cheap, supply exceeds demand