Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hai,
I want to use the variables that already declared in variable overview of an Application.
Is it possible to Export the variable.
and how to use same variable for an new application. Can anyone let me know.Its very useful for me.
Regard,
Vijay
Hi
I don't know of a way to export your current variables, however, the way I set up QlikView to allow re-using variables is that I define them all in a QVS file and then include the file in the load script. I have attached a copy of a QVS file to this message (please note: I had to rename it to .QVS.TXT to get it to attach) so you can take a look, in the load script you would simply add in a line like this:
$(Include = "\QlikView\QVS\StandardVariables.QVS")
Good luck,
Hai,
Thanks for your reply.
If i declare the variable in Edit script it is easy to export it into QVS file and use that in other application.
But i need an way to export the variable that declare in variable overview. if you find any solution please let me know. its very useful.
Thanks
Regards
Vijay
Hi,
This little macro will export all the names of the document variables to a .txt file. The file location should be defined in the variable vExportTo. It would be quite easy to also export the variable values too. Remember to change the module security too to allow access to the system.
sub ExportVarNames
set doc = ActiveDocument
vExportTo = doc.Variables("vExportTo").GetContent.String
set fso = CreateObject("Scripting.FileSystemObject")
on error resume next
set logFile = fso.GetFile(vExportTo)
if err <> 0 then ' file does not exist
on error goto 0
set logFile = fso.CreateTextFile(vExportTo)
set logFile = fso.GetFile(vExportTo)
else
on error goto 0
end if
set txsStream = logFile.OpenAsTextStream(8) ' append
set vars = ActiveDocument.GetVariableDescriptions
for i = 0 to vars.Count - 1
set v = vars.Item(i)
txsStream.WriteLine v.Name
next
txsStream.Close
end sub
Regards,
Gordon
Hi Gordon,
I'm also trying to do same as vijayakumar. You written a macro to export all the variables into text file it is working fine. But how can i use this variables in another qlikview file along with data of the variables.
- I can see only variables name in the text file but there is no data for particular variables. I declared variable vExportTo='C:\Jagan\QVExamples\RTQ\RTQ\aa.txt
Is it correct? If correct how can i overcome this problem?
change your for-next loop to:
for i = 0 to vars.Count - 1
set v = vars.Item(i)
txsStream.WriteLine v.Name & chr(9) & v.RawValue
next
this will create a tab-separated list for var names and values.
Hi,
It is not working for me..
I get error "Object required: 'doc.Variables(...)'"....
Make sure you have the variable defined that holds the path to your export location. In this case, define vExportTo in your app. (Ctrl-V is the shortcut to the variable list)
Tnx
it work now perfectly!
I'm using AxQlikOCX to export all variables with name and value. This is my code:
Doc = AxQlikOCX.Application.OpenDocEx([Path to QVW-document], 1, False, , , , True)
Dim vars
Dim v
vars = Doc.GetVariableDescriptions
For i As Integer = 0 To vars.count - 1
v = vars.item(i)
debug.print v.Name & " = " & v.RawValue
Next
I get the name but value is empty!
Any ideas?