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

Create a filename for ServerSideExportEx based on variable

Hello,

This seems like it should be SOOO SIMPLE but I'm pulling my hair out :

I have table that the user will choose to save using a button. 

In my vbscript for the button, I am trying to modify the path and name where the ServerSideExportEx saves the file. 

This works:

tb.ServerSideExportEx "D:\QlikView_documents\Developpement\1-Sources\XML\Provisions.xml" , ";" , 3 '0=HTML, 1=Text, 2=Bitmap, 3=XML, 4=QVD, 5=BIFF

But I'd like to pass the path and the file name as variables. 

The file name will be "Provisions_" & [year - month selected]. 

My file path and the year-month selected are both variables in the qwd, so I tried this :

set dateProvisions = ActiveDocument.Variables("vDateProvision")

set pathProvisions = ActiveDocument.Variables("vRepSourcesXml")

set fileName = "Provisions_$(vDateProvision).xml"

This bombs. 

My next work-around was to create a variable in the qwd that saves the file name as "Provisions_"&$(vDateProvision)&".xml"


I can't get my variable to work correctly either! 

In the variables menu, I set the variable to "Provisions_"&$(vDateProvision)&".xml" -- no good. 

Then I tried concat("Provisions_",$(vDateProvision),".xml") -- also no good. 


Does anyone have any suggestions ?


Thanks!

1 Solution

Accepted Solutions
jerrysvensson
Partner - Specialist II
Partner - Specialist II

Strange

I would try:

MsgBox pathProvisions.GetContent.String

MsgBox dateProvisions.GetContent.String

Just to make sure everything is ok.

And then start adding them together one after the other. Using MsgBox

View solution in original post

14 Replies
jerrysvensson
Partner - Specialist II
Partner - Specialist II

set dateProvisions = ActiveDocument.Variables("vDateProvision")


fileName = "Provisions_" & dateProvisions.GetContent.String &".xml"

leenlart
Creator
Creator
Author

Opps, I forgot to mention that I tried that originally. 

This is where my vbscript stops. 

petter
Partner - Champion III
Partner - Champion III

How does the content of the vDateProvision look like - and how does the content of dataProvisions look like exactly?

jerrysvensson
Partner - Specialist II
Partner - Specialist II

I agree with Peter.

Use MsgBox dateProvisions.GetContent.String to look at the value.

leenlart
Creator
Creator
Author

In my variables I set vDateProvision to this :

vDateProvision.png

And when I run my script, I get

msgbox.png

for info DateProvision is the Date selected. 

leenlart
Creator
Creator
Author

to be clear, the msgbox is showing the following:

set dateProvisions = ActiveDocument.Variables("vDateProvision")

ActiveDocument.GetApplication.MsgBox( dateProvisions.GetContent.String)

jerrysvensson
Partner - Specialist II
Partner - Specialist II

Ok

So then

fileName = "Provisions_" & dateProvisions.GetContent.String &".xml"

Should work


By the way. This is incorrect:.

Set fileName = "Provisions_" & dateProvisions.GetContent.String &".xml"


leenlart
Creator
Creator
Author

I just took out the set. 

It still doesn't work! 

A new idea, can I set the file name directly in the tb.ServerSideExportEx line ? 

I just tried this :

tb.ServerSideExportEx pathProvisions & "\" & "Provisions_" & dateProvisions.GetContent.String & ".xml", ";" , 3

But it didn't work...

Is there some way to run a debugger, or to get an error message ? 

jerrysvensson
Partner - Specialist II
Partner - Specialist II

MsgBox pathProvisions & "\" & "Provisions_" & dateProvisions.GetContent.String & ".xml"

Is unfortunately the only way out..