Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
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

1 Solution

Accepted Solutions
Not applicable
Author

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
pokassov
Specialist
Specialist

Hi!

The one way I know is to use additional variable.

/VvGroupType=1

and rewrite variable vGroup;

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

Not applicable
Author

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