Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Not applicable

How to pass a parameter to ZFC application?

There is an old thread explaining how to pass a parameter to a ZFC based application, but the actual code is hidden in that post!

It seems like onOpen document event macro is not being called when the application is accessed thro ZFC.

Can someone suggest an alternate way of achieving this? Appreciate any help..

Tags (3)
1 Solution

Accepted Solutions
Not applicable

How to pass a parameter to ZFC application?

Hi!

You just have to do some javascript!

In the default.htm you add:


function init(key, name)
{
var val = Qva.ExtractProperty(key);
if(val) qva.Set(name,'text',val,false);
}

init('param','LB01');


Your URL is then something like http://server/AJAXApplication/default.htm?param=Customer1 where LB01 is the ID of your listbox and "Customer1" the value you want to select.

See attachment for details!
Things can become more complicated if you want to hand over multiple values and/or lock your selection. But for simply passing the parameter this should be fine..

11 Replies
Not applicable

How to pass a parameter to ZFC application?

Hi!

You just have to do some javascript!

In the default.htm you add:


function init(key, name)
{
var val = Qva.ExtractProperty(key);
if(val) qva.Set(name,'text',val,false);
}

init('param','LB01');


Your URL is then something like http://server/AJAXApplication/default.htm?param=Customer1 where LB01 is the ID of your listbox and "Customer1" the value you want to select.

See attachment for details!
Things can become more complicated if you want to hand over multiple values and/or lock your selection. But for simply passing the parameter this should be fine..

Not applicable

How to pass a parameter to ZFC application?

Thanks rva! That really helped.. 2 more qns!

1) Is there a way to set a QlikView document variable through Javascript?

2) Where can I find more information about these available functions like Qva.ExtractProperty?

Thanks again...

Not applicable

How to pass a parameter to ZFC application?

One more problem!

It seems that in order to use avqSet, the list box has to be in show mode. I created a list box of id column and made it hidden so that other application can pass id parameter and i could set it up on the list box. So far i found that when i use avqSet on hidden list box, it gives an error as - Server Error, Session timed out, reconnecting... and keeps giving the same error messages even though i press ok. I have to kill the IE process!

So is there any way to use hidden list boxes and be able to set values in those?

Appreciate any help...

Not applicable

How to pass a parameter to ZFC application?

I would do it a different way:

Instead of setting the listbox hidden in QlikView, I modify the HTML-Code generated for the AJAX-Client.

  • Go to the .htm file
  • Locate the listbox you want to hide
  • add in the CSS-style of the tag visibility:hidden

So the enduser does not see the listbox, but you can set a value through avqSet.

For your other questions:

I don't know any official documentation. However you have all the Javascript libraries installed with your QlikView server. So take a look at the Javascript files to understand more about it.

I don't know if you can set a variable directly. But probably you can set an InputBox which then sets an variable!

mellerbeck
Contributor II

How to pass a parameter to ZFC application?

Do you know if it is possible to use the init('param','LB01') with something like a table box or a chart??

so like init('param','CH03') or init('param','TB01')

etc....

Thank you for any clues!

Not applicable

How to pass a parameter to ZFC application?

Thanks rva.

I solved the problem by making height and width as 0 points in the html for the list boxes which I want to hide. Although visibility:hidden seems to be a better way of doing it.. will check that out..


Now, a fundamental problem.. client (IE) calls this AJAX based QlikView app by using http://xxx.com/ajax/SH09.htm?userid=xxxx&param=value

The ajax page extract the param, set the value in list box, and the data is presented based on the selection of param field. Now, if IE window is refreshed, same process is repeated again, and based on default behavior of QlikView, instead of setting the param value, it deselects it !! So the client gets to see the whole data !!

I might have to disable IE "Refresh" completely. (atm, not sure if thats possible) But do you have any other ideas that you can suggest? Apart from browser refresh, there may be other ways of deselecting the param value and exposing the whole data. So would like to fix it at the root itself.

Not applicable

How to pass a parameter to ZFC application?

Btw, will not be able to implement Dynamic Data Reduction for the above issue. Our QV app will be opened to other multiple apps within the company. Other apps need bits and pieces from our QV app. As such, upfront we dont know the incoming users and their security level so cant restrict the data by using section access. The only way for us is to enforce other apps to pass on filter criteria and we will present the data based on the filters passed. Afterwards, client should not be able to navigate anything apart from the data presented in the beginning..

Not applicable

How to pass a parameter to ZFC application?

@mellerbeck:

I don't see any reason why to do that!
Filtering data in Qlikview always happens through listboxes. So setting a value in a listbox will always cause your chart, table box to update to the current selection.

If you don't want to show the listbox, see the postings above. Just hide the listbox with CSS visibility:hidden; in the HTML-Code.

Not applicable

How to pass a parameter to ZFC application?

May this code example helps. Instead of setting the parameter in the default.htm I once did the following at <body>-onload on the SH01.htm

It also locks the selection, so this is some way where a user can not leave this selection that easy.


function QueryAndLock()
{
try
{
accountValue = Qva.ExtractProperty ("AccountName");
if (accountValue.length > 0)
{
// needed to replace Blanks, as Salesforce delivers these as "+"
accountValue = accountValue.replace("+"," ");
// alert (accountValue);
// Unlock the listbox
qva.Set("Document.LB95.ULC", "action", "", true);
// clear the listbox
qva.Set(".LB95", "search", "*", true);
qva.Set(".LB95", "closesearch", "accept", true);
// query fro the right account
qva.Set(".LB95", "search", accountValue, true);
qva.Set(".LB95", "closesearch", "accept", true);
// lock the listbox
qva.Set("Document.LB95.LOC", "action", "", false);
}
}
catch (e)
{
// alert ("no matching parameters");
}
}


Community Browser