Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rustyfishbones
Master II
Master II

Generating SVG File in Qlikview Issue

Hi All,

I am trying to generate an SVG file in Qlikview, however I get a problem when I output the file to the .svg

I have the following script in Qlik, I am using a preceding load to add double quotes around the necessary text

svg.png

In the Qlikview file it's correct, but when it outputs to the SVG file I have quotes around my quotes like below

file.png

How can I remove the Quotes so that I end up with the following

file2.png

1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

You could also try using a macro

Aufnahme_2017_07_27_13_04_19_741.gif

see attached

hope this helps

View solution in original post

7 Replies
Gysbert_Wassenaar

Can't be done with Qlikview script afaik. You could store the output in a .svg file and then process that file to remove the extra quotes with for example powershell script command:

cat .\WaffleChart.svg | % { $_ -replace """""", "@@" } | % {$_ -replace """", "" } | % {$_ -replace "@@", """"}

Using sed or a python script are some other options.


talk is cheap, supply exceeds demand
Frank_Hartmann
Master II
Master II

You could also try using a macro

Aufnahme_2017_07_27_13_04_19_741.gif

see attached

hope this helps

rustyfishbones
Master II
Master II
Author

I have never used powerscript before.

could I execute a .bat file from Qlikview to run powerscript and remove the Quotes?

rustyfishbones
Master II
Master II
Author

Thanks Frank, this works perfectly

rustyfishbones
Master II
Master II
Author

Hi Gysbert,

Do you mean PowerShell command?

Regards

Alan

Gysbert_Wassenaar

uh yeah, that.


talk is cheap, supply exceeds demand
rustyfishbones
Master II
Master II
Author

Hi Gysbert,

So I got it working with the following Powershell script to remove unwanted Quotes

Set-ExecutionPolicy Unrestricted 

(Get-content .\WaffleChart.svg) | ForEach-Object{$_ -replace "`"`"", "`""} | ForEach-Object{$_ -replace "`"<", "`<" } | ForEach-Object{$_ -replace ">`"", ">" } | Set-content .\WaffleChart.svg

And I managed to EXECUTE from Qlikview script - needed to make a few changes in

User Preferences>>Secuirty etc..

But I got it working with the following Qlikview Script.

LET title = 'WaffleChart';

SVG:

LOAD * INLINE [

     <!--svg-->

    <svg width="800" height="800" fill="grey" xmlns="http://www.w3.org/2000/svg">

    <Title>"$(title)"</Title>

    <g>

];

LET y = 5;

LET x = 15;

LET width = 15;

LET height = 15;

LET strokewidth = 1;

LET stroke = '#ff0000';

LET fill   = 'white';

LET id = 1;

for j = 1 to 10

          FOR i = 1 to 10

               concatenate(SVG)

               LOAD * INLINE [

               <!--svg-->

               <rect id="$(id)" height="$(height)" width="$(width)" y="$(y)" x="$(x)" stroke-width="$(strokewidth)"                stroke="$(stroke)" fill="$(fill)"/>

               ];

          LET x = $(x) + $(width);

          LET id = $(id) + 1;

          NEXT i

          LET y = $(y) + $(height);

          LET x = $(width);

NEXT j

concatenate(SVG)

LOAD * INLINE [

<!--svg-->

    </g>

    </svg>

];

STORE SVG INTO .\WaffleChart.svg (txt);

//Ensure Security Settings are all ticked in User Preferences

 

LET ps = 'C:\Users\Alan.PRINCIPAL\Desktop\SVG\wafflechart.ps1'; 

 

EXECUTE powershell.exe $(ps);