Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
michielvandegoo
Valued Contributor

Double quotes and store to

Hi, I want to generate command line list to use in a bat file in.

I defined 5 variables with SET for the fixed text parts of my command line. these will be combined with a variable, created from a list and called one by one with a peek.

I get double quotes in my results when I do not need them.

If I call variable 1: set part1 = 'C:\Program Files (x86)\Advanced XML Converter\exporter.exe';

as '$(part1)' as ....

and store BatFile to BatFile.bat (txt);

I get this result: C:\Program Files (x86)\Advanced XML Converter\exporter.exe

Should be: "C:\Program Files (x86)\Advanced XML Converter\exporter.exe"

If I change part 1 to set part1 = '"C:\Program Files (x86)\Advanced XML Converter\exporter.exe"';

I get this: """C:\Program Files (x86)\Advanced XML Converter\exporter.exe"""

I need to get rid off these extra "".

The table BatFile.bat is generated with Autogenerate(1) for each line.

How to get rid off the extra double quotes?

1 Solution

Accepted Solutions
gardenierbi
Contributor

Re: Double quotes and store to

MichielvandeGoor : Enclose your whole command in another pair of quotes :

EXECUTE CMD.exe /C ""C:\Program Files (x86)\Advanced XML Converter\exporter.exe" Parameter1 Parameter 2";
11 Replies
giakoum
Honored Contributor II

Re: Double quotes and store to

use Chr(39) instead of "

Chr(39) & 'C:\Program Files (x86)\Advanced XML Converter\exporter.exe' & Chr(39)

giakoum
Honored Contributor II

Re: Double quotes and store to

Sorry! Chr(34) is double quotes

Gabriel
Valued Contributor II

Re: Double quotes and store to

Hi,

I would try changing SET to LET in the script.

Hope that helps

michielvandegoo
Valued Contributor

Re: Double quotes and store to

LET instead of SET doesn't make a difference

michielvandegoo
Valued Contributor

Re: Double quotes and store to

I tried this allready. Thanks anyway.

peter_turner
Valued Contributor

Re: Double quotes and store to

Hi,

You need to use the original part1, add the additional double quotes around it, and combine with the & symbol to build your query such as 

Let vDosCMD=' " ' & 'C:\Program Files (x86)\Advanced XML Converter\exporter.exe' & ' " ' & other strings here

You can then use the EXECUTE $(vDosCMD) or similar to run the command.

This way you can pass parameters to your dos command etc as needed.

michielvandegoo
Valued Contributor

Re: Double quotes and store to

Peter,

In QlikView the result looks ok but in the export .bat (txt) file is get the same result as previous tries:

" ""C:\Program Files (x86)\Advanced XML Converter\exporter.exe"" "

Let vDosCMD=' "' & 'C:\Program Files (x86)\Advanced XML Converter\exporter.exe' & '" ';// & other strings here

BatFile:

load

  '$(vDosCMD)' as [@echo off]

  AutoGenerate (1);

store BatFile into C:\Lokale bestanden\Customer\xml_to_csv\BatFile.bat (txt);

michielvandegoo
Valued Contributor

Re: Double quotes and store to

I used your suggestion and created a table build out of all components for the content of the bat file.For test I exported the table as text to notepad, saved as .bat and started if from the command line.

The content works as needed.

Now automate the export with a macro and add the .bat to the Supporting tasks in Publisher.

Thanks all!

michielvandegoo
Valued Contributor

Re: Double quotes and store to

Export to file or store brings the double quotes right back.

A manual export from the table doesn't but that is a show stopper.

Community Browser