Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Not applicable

Passing multiple parameters

Hi,

I appreciate that this has been discussed elsewhere, but the answers so far don't quite address my particular problem.

I'm trying to pass two parameters into a QV report which will specify 1.) The sheet to go to and 2.) The data that will be displayed on that sheet.

The method I'm using is:

a.) Create a variable for each parameter. In my case they are named vSheet and vKeyClientName. These are both left blank.

b.) Create a subprocedure with the following syntax:

sub whenopen()

  set v = ActiveDocument.GetVariable("vSheet")

  ActiveDocument.Sheets(v.GetContent.String).Activate

  set f = ActiveDocument.Fields("CLIENT.NAME")

  set g = ActiveDocument.GetVariable("vKeyClientName")

  f.select g.GetContent.String

end sub

c.) Create a document event trigger on OnOpen to run the 'whenopen' sub.

The parameter string I'm passing in for the vKeyClientName parameter only looks like:

http://servername/QvAJAXZfc/AccessPoint.aspx?open=&id=QVS@servername%7CQlikview/Documents/Aderant_Ke...

This works fine.

I can use a very similar URL string to pass in the vSheet parameter only. Again, this works fine.

The problem arises when I try to pass in both parameters using the following syntax:

http://servername/QvAJAXZfc/AccessPoint.aspx?open=&id=QVS@servername%7CQlikview/Documents/Aderant_Ke...&vSheet=9

This URL string results in neither parameter being recognised. No error is thrown by the script.

Can anyone suggest what I'm doing wrong here? All I have read so far seems to indicate that an ampersand between parameters should result in both being processed?.

Thanks, Gavin

1 Solution

Accepted Solutions
Not applicable

Re: Passing multiple parameters

HI Gavin

Can you confirm whether a macro works fine with the first example or is it just the variable that works okay? It might be the order that QlikView does the on open task, or that the macro may not function properly in AJAX...

As an aside, I have a similar issue passing parameters in a task to reload a document in publisher. It seems to only accept one variable, so my work around was to save one variable, and the content would be separated by pipes.

EG vLoadVariable=   '01/04/2013|WEST|2'

The three variables I need for the script are calculated from this one value, using subfield to separate the individual items

SET vdate = subfield(vLoadVariable,1);

SET vArea = subfield(vLoadVariable,2);

SET vItem = subfield(vLoadVariable,3);

You could work around (although not ideal) by either:

1) Set three variables in the document that are functions of the one parameter, using subfield; or

2) in the VB script, set the variables you need. dim vSubstring as string = vParameter.indexof('|')

Erica

3 Replies
Not applicable

Re: Passing multiple parameters

HI Gavin

Can you confirm whether a macro works fine with the first example or is it just the variable that works okay? It might be the order that QlikView does the on open task, or that the macro may not function properly in AJAX...

As an aside, I have a similar issue passing parameters in a task to reload a document in publisher. It seems to only accept one variable, so my work around was to save one variable, and the content would be separated by pipes.

EG vLoadVariable=   '01/04/2013|WEST|2'

The three variables I need for the script are calculated from this one value, using subfield to separate the individual items

SET vdate = subfield(vLoadVariable,1);

SET vArea = subfield(vLoadVariable,2);

SET vItem = subfield(vLoadVariable,3);

You could work around (although not ideal) by either:

1) Set three variables in the document that are functions of the one parameter, using subfield; or

2) in the VB script, set the variables you need. dim vSubstring as string = vParameter.indexof('|')

Erica

Not applicable

Re: Passing multiple parameters

Thanks Erica, that has answered my question. To answer your question, the macro did seem to work fine with the first example, but in any case I've used your suggestion of using a single variable with the components separated by pipes.

The working code is:

     sub whenopen()

            'Break single pass-in variable into chunks

            set a = ActiveDocument.GetVariable("vKeyClientName")

            c = instr(a.GetContent.String, "|")

            Client = left(a.GetContent.String,c-1)

            Sheet = right(a.GetContent.String,1)

            'Activate Sheet

            ActiveDocument.Sheets(Sheet).Activate

            'Select Client Name

            set f = ActiveDocument.Fields("CLIENT.NAME")

            f.select Client

     end sub

Thanks, Gavin

Not applicable

Re: Passing multiple parameters

No problem. Have just tried to pass more than one parameter myself in the URL too, would be interesting to see what the reason for it is.

Erica