Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Error while setting a QV Variable in a batch file

Hi,

Hopefully there is a simple solution for this. I have a batch file that goes like this:

ECHO OFF

CLS

"C:\Program Files\QlikView\QV.exe" /L /VvGroup="Cake" "Path\v2\Demo_Model.qvw"

Echo Party Food Done!

which works perfectly, the model opens, sets the variable and refreshes - as you can see the variable set is vGroup = Cake, but as soon as i set the variable to a string with a gap:

ECHO OFF

CLS

"C:\Program Files\QlikView\QV.exe" /L /VvGroup="Party Food" "Path\v2\Demo_Model.qvw"

Echo Party Food Done!

vGroup = Party Food

I get an error.

Any ideas on a way around this?

Thanks,

Regards,

Richard

Tags (2)
1 Solution

Accepted Solutions
Highlighted
Not applicable

Re: Error while setting a QV Variable in a batch file

Thanks Sergey,

I did something similar,

I actually added an underscore to the variable name in the batch file and used a replace formula in the model to get the space back in.

Batch File:

ECHO OFF

CLS

"C:\Program Files\QlikView\QV.exe" /L /VvGroup="Party_Food" "Path\v2\Demo_Model.qvw"

Echo Party Food Done!

Edit Module in Model:

Sub AfterReload

Set v = ActiveDocument.Variables("vGroup")

vGroup = v.GetContent.String

vGroup = Replace(t, Chr(95), Chr(32))

(....I could then use vGroup when going ahead with my Macro....)

End Sub

Thanks

Richard

View solution in original post

2 Replies
Highlighted
Specialist
Specialist

Re: Error while setting a QV Variable in a batch file

Hi!

The one way I know is to use additional variable.

/VvGroupType=1

and rewrite variable vGroup;

=if(vGroupType=1,'Party Food')

Highlighted
Not applicable

Re: Error while setting a QV Variable in a batch file

Thanks Sergey,

I did something similar,

I actually added an underscore to the variable name in the batch file and used a replace formula in the model to get the space back in.

Batch File:

ECHO OFF

CLS

"C:\Program Files\QlikView\QV.exe" /L /VvGroup="Party_Food" "Path\v2\Demo_Model.qvw"

Echo Party Food Done!

Edit Module in Model:

Sub AfterReload

Set v = ActiveDocument.Variables("vGroup")

vGroup = v.GetContent.String

vGroup = Replace(t, Chr(95), Chr(32))

(....I could then use vGroup when going ahead with my Macro....)

End Sub

Thanks

Richard

View solution in original post