<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Exporting all variables from the Qlikview application using macro in Member Articles</title>
    <link>https://community.qlik.com/t5/Member-Articles/Exporting-all-variables-from-the-Qlikview-application-using/ta-p/1556260</link>
    <description>&lt;P&gt;Hi everyone!!&lt;/P&gt;&lt;P&gt;It’s about VBScript macro which export all variables from your Qlikview application. You can call it by using a button object or using document event triggers (OnPostReload) located in Settings menu Document Properties option and&amp;nbsp; tab Triggers, for example.&lt;/P&gt;&lt;P&gt;So, why am I develped it? I'll tell you why. A friend of mine was talking about variables sincronization issues between his Qlikview and Qliksense applications.&amp;nbsp; Every time when he create a new variable or he changed&amp;nbsp;&amp;nbsp; the variable definition or even in its comment, he had to replicate this changes to another application which,&amp;nbsp; sometimes, he forgot to do it.&lt;/P&gt;&lt;P&gt;Firstly, I’ve searched if was there some solution on the Qlik Community. Unfortunately, I didn't found nothing ready. So, that's why I developed it. Since then, my friend has been using this macro in his applications and the variables sincronization issues was solved. He just call the macro through document event triggers, setting (OnPostReload) option and then the macro load every single variable into a file (*.csv) which is created in the same folder of your Qlikview application. Once the variables was exported our Qliksense application could be load it and create each variable easily.&lt;/P&gt;&lt;P&gt;Just to be clear and understandable how it works, I attached as example two files&amp;nbsp; (*.qvw) where one of them is the application which need to export his variables every time its reloaded and another is the application which will load data the exported file and it will create every single variable.&lt;/P&gt;&lt;P&gt;When you will open macro editor from the application which will export the variables you will can easily change the file name and its folder destiny. You will can change columns name as well.&lt;/P&gt;&lt;P&gt;So, that is it! I hope it can be useful for everyone!&lt;/P&gt;&lt;P&gt;You can read the scripts below:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ExportVarApp (Macro):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Sub ExportVar()&lt;/P&gt;&lt;P&gt;set docprop = ActiveDocument.GetProperties&lt;BR /&gt;wd = docprop.MyWorkingDirectory&lt;BR /&gt;wdEx = wd &amp;amp; "\VariablesApp\"&lt;BR /&gt;&lt;BR /&gt;Set fileSystemObject = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;If Not fileSystemObject.FolderExists(wdEx) Then&lt;BR /&gt;fileSystemObject.CreateFolder(wdEx)&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;vNameFile = fileSystemObject.GetBaseName(ActiveDocument.Name) 'Getting Qlikview's document name&lt;BR /&gt;fPath = wdEx &amp;amp; vNameFile &amp;amp; "_Variables.csv"&lt;/P&gt;&lt;P&gt;On Error Resume Next&lt;BR /&gt;Err.Clear&lt;BR /&gt;if fileSystemObject.FileExists(fPath) Then&lt;BR /&gt;&lt;BR /&gt;fileSystemObject.DeleteFile(fPath)&lt;BR /&gt;&lt;BR /&gt;if Err.Number &amp;lt;&amp;gt; 0 then&lt;BR /&gt;' An exception occurred&lt;BR /&gt;msgbox "Exception:" &amp;amp; vbCrLf &amp;amp;_&lt;BR /&gt;" Error number: " &amp;amp; Err.Number &amp;amp; vbCrLf &amp;amp;_&lt;BR /&gt;" Error description: '" &amp;amp; Err.Description &amp;amp; vbCrLf &amp;amp;_&lt;BR /&gt;" File cannot be deleted because it still open for another application." &amp;amp; vbCrLf &amp;amp;_&lt;BR /&gt;" Please, close " &amp;amp; vNameFile &amp;amp; " file and try it again." &amp;amp; vbCrLf&lt;BR /&gt;exit sub&lt;BR /&gt;else&lt;BR /&gt;set fileSystemObject = Nothing&lt;/P&gt;&lt;P&gt;Set objFSO = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;'--------------------------------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;' ForReading = 1 - Open a file for reading only. You can't write to this file.&lt;BR /&gt;' ForWriting = 2 - Open a file for writing only. Use this mode to replace an existing file with new data. You can't read from this file.&lt;BR /&gt;' ForAppending = 8 - Open a file and write to the end of the file. You can't read from this file.&lt;BR /&gt;'--------------------------------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Const ForAppending = 8&lt;BR /&gt;vSep = "|" 'Delimiter or Separator of fields'&lt;BR /&gt;vColumn1 = "VarName"&lt;BR /&gt;vColumn2 = "VarDefinition"&lt;BR /&gt;&lt;BR /&gt;set MyVarsApp = ActiveDocument.GetVariableDescriptions&lt;BR /&gt;&lt;BR /&gt;for i = 0 to MyVarsApp.Count - 1&lt;BR /&gt;set vObj = MyVarsApp.Item(i)&lt;BR /&gt;Set objTS = objFSO.OpenTextFile(fPath, ForAppending, true)&lt;BR /&gt;if i = 0 then&lt;BR /&gt;objTS.WriteLine(vColumn1 &amp;amp; vSep &amp;amp; vColumn2)&lt;BR /&gt;objTS.WriteLine(vObj.Name &amp;amp; vSep &amp;amp; vObj.RawValue)&lt;BR /&gt;else&lt;BR /&gt;objTS.WriteLine(vObj.Name &amp;amp; vSep &amp;amp; vObj.RawValue)&lt;BR /&gt;end if&lt;BR /&gt;objTS.Close()&lt;BR /&gt;next&lt;BR /&gt;msgbox("Arquivo " &amp;amp; vNameFile &amp;amp; "_Variables.csv" &amp;amp; " was exported with success!!")&lt;BR /&gt;end if&lt;BR /&gt;end if&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ImportVarApp (Loading and creating variables)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;//Load variables&lt;BR /&gt;VarTable:&lt;BR /&gt;LOAD VarName,&lt;BR /&gt;VarDefinition&lt;BR /&gt;FROM&lt;BR /&gt;VariablesApp\ExportVarApp_Variables.csv&lt;BR /&gt;(txt, codepage is 1252, embedded labels, delimiter is '|', msq);&lt;/P&gt;&lt;P&gt;//Creating variables&lt;BR /&gt;For i = 0 to NoOfRows('VarTable') - 1&lt;/P&gt;&lt;P&gt;Let vVarName = peek('VarName', i, 'VarTable'); // Name of the variable&lt;/P&gt;&lt;P&gt;Let $(vVarName) = peek('VarDefinition', i, 'VarTable'); // Definition of the variable&lt;/P&gt;&lt;P&gt;Next i&lt;/P&gt;&lt;P&gt;//Destroying variables of control&lt;BR /&gt;Let i = null();&lt;/P&gt;&lt;P&gt;Let vVarName = null(); //&lt;/P&gt;&lt;P&gt;Drop Table VarTable;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Sep 2022 17:07:35 GMT</pubDate>
    <dc:creator>gilbertomedeiro</dc:creator>
    <dc:date>2022-09-21T17:07:35Z</dc:date>
    <item>
      <title>Exporting all variables from the Qlikview application using macro</title>
      <link>https://community.qlik.com/t5/Member-Articles/Exporting-all-variables-from-the-Qlikview-application-using/ta-p/1556260</link>
      <description>&lt;P&gt;Hi everyone!!&lt;/P&gt;&lt;P&gt;It’s about VBScript macro which export all variables from your Qlikview application. You can call it by using a button object or using document event triggers (OnPostReload) located in Settings menu Document Properties option and&amp;nbsp; tab Triggers, for example.&lt;/P&gt;&lt;P&gt;So, why am I develped it? I'll tell you why. A friend of mine was talking about variables sincronization issues between his Qlikview and Qliksense applications.&amp;nbsp; Every time when he create a new variable or he changed&amp;nbsp;&amp;nbsp; the variable definition or even in its comment, he had to replicate this changes to another application which,&amp;nbsp; sometimes, he forgot to do it.&lt;/P&gt;&lt;P&gt;Firstly, I’ve searched if was there some solution on the Qlik Community. Unfortunately, I didn't found nothing ready. So, that's why I developed it. Since then, my friend has been using this macro in his applications and the variables sincronization issues was solved. He just call the macro through document event triggers, setting (OnPostReload) option and then the macro load every single variable into a file (*.csv) which is created in the same folder of your Qlikview application. Once the variables was exported our Qliksense application could be load it and create each variable easily.&lt;/P&gt;&lt;P&gt;Just to be clear and understandable how it works, I attached as example two files&amp;nbsp; (*.qvw) where one of them is the application which need to export his variables every time its reloaded and another is the application which will load data the exported file and it will create every single variable.&lt;/P&gt;&lt;P&gt;When you will open macro editor from the application which will export the variables you will can easily change the file name and its folder destiny. You will can change columns name as well.&lt;/P&gt;&lt;P&gt;So, that is it! I hope it can be useful for everyone!&lt;/P&gt;&lt;P&gt;You can read the scripts below:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ExportVarApp (Macro):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Sub ExportVar()&lt;/P&gt;&lt;P&gt;set docprop = ActiveDocument.GetProperties&lt;BR /&gt;wd = docprop.MyWorkingDirectory&lt;BR /&gt;wdEx = wd &amp;amp; "\VariablesApp\"&lt;BR /&gt;&lt;BR /&gt;Set fileSystemObject = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;If Not fileSystemObject.FolderExists(wdEx) Then&lt;BR /&gt;fileSystemObject.CreateFolder(wdEx)&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;vNameFile = fileSystemObject.GetBaseName(ActiveDocument.Name) 'Getting Qlikview's document name&lt;BR /&gt;fPath = wdEx &amp;amp; vNameFile &amp;amp; "_Variables.csv"&lt;/P&gt;&lt;P&gt;On Error Resume Next&lt;BR /&gt;Err.Clear&lt;BR /&gt;if fileSystemObject.FileExists(fPath) Then&lt;BR /&gt;&lt;BR /&gt;fileSystemObject.DeleteFile(fPath)&lt;BR /&gt;&lt;BR /&gt;if Err.Number &amp;lt;&amp;gt; 0 then&lt;BR /&gt;' An exception occurred&lt;BR /&gt;msgbox "Exception:" &amp;amp; vbCrLf &amp;amp;_&lt;BR /&gt;" Error number: " &amp;amp; Err.Number &amp;amp; vbCrLf &amp;amp;_&lt;BR /&gt;" Error description: '" &amp;amp; Err.Description &amp;amp; vbCrLf &amp;amp;_&lt;BR /&gt;" File cannot be deleted because it still open for another application." &amp;amp; vbCrLf &amp;amp;_&lt;BR /&gt;" Please, close " &amp;amp; vNameFile &amp;amp; " file and try it again." &amp;amp; vbCrLf&lt;BR /&gt;exit sub&lt;BR /&gt;else&lt;BR /&gt;set fileSystemObject = Nothing&lt;/P&gt;&lt;P&gt;Set objFSO = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;'--------------------------------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;' ForReading = 1 - Open a file for reading only. You can't write to this file.&lt;BR /&gt;' ForWriting = 2 - Open a file for writing only. Use this mode to replace an existing file with new data. You can't read from this file.&lt;BR /&gt;' ForAppending = 8 - Open a file and write to the end of the file. You can't read from this file.&lt;BR /&gt;'--------------------------------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Const ForAppending = 8&lt;BR /&gt;vSep = "|" 'Delimiter or Separator of fields'&lt;BR /&gt;vColumn1 = "VarName"&lt;BR /&gt;vColumn2 = "VarDefinition"&lt;BR /&gt;&lt;BR /&gt;set MyVarsApp = ActiveDocument.GetVariableDescriptions&lt;BR /&gt;&lt;BR /&gt;for i = 0 to MyVarsApp.Count - 1&lt;BR /&gt;set vObj = MyVarsApp.Item(i)&lt;BR /&gt;Set objTS = objFSO.OpenTextFile(fPath, ForAppending, true)&lt;BR /&gt;if i = 0 then&lt;BR /&gt;objTS.WriteLine(vColumn1 &amp;amp; vSep &amp;amp; vColumn2)&lt;BR /&gt;objTS.WriteLine(vObj.Name &amp;amp; vSep &amp;amp; vObj.RawValue)&lt;BR /&gt;else&lt;BR /&gt;objTS.WriteLine(vObj.Name &amp;amp; vSep &amp;amp; vObj.RawValue)&lt;BR /&gt;end if&lt;BR /&gt;objTS.Close()&lt;BR /&gt;next&lt;BR /&gt;msgbox("Arquivo " &amp;amp; vNameFile &amp;amp; "_Variables.csv" &amp;amp; " was exported with success!!")&lt;BR /&gt;end if&lt;BR /&gt;end if&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ImportVarApp (Loading and creating variables)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;//Load variables&lt;BR /&gt;VarTable:&lt;BR /&gt;LOAD VarName,&lt;BR /&gt;VarDefinition&lt;BR /&gt;FROM&lt;BR /&gt;VariablesApp\ExportVarApp_Variables.csv&lt;BR /&gt;(txt, codepage is 1252, embedded labels, delimiter is '|', msq);&lt;/P&gt;&lt;P&gt;//Creating variables&lt;BR /&gt;For i = 0 to NoOfRows('VarTable') - 1&lt;/P&gt;&lt;P&gt;Let vVarName = peek('VarName', i, 'VarTable'); // Name of the variable&lt;/P&gt;&lt;P&gt;Let $(vVarName) = peek('VarDefinition', i, 'VarTable'); // Definition of the variable&lt;/P&gt;&lt;P&gt;Next i&lt;/P&gt;&lt;P&gt;//Destroying variables of control&lt;BR /&gt;Let i = null();&lt;/P&gt;&lt;P&gt;Let vVarName = null(); //&lt;/P&gt;&lt;P&gt;Drop Table VarTable;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 17:07:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Exporting-all-variables-from-the-Qlikview-application-using/ta-p/1556260</guid>
      <dc:creator>gilbertomedeiro</dc:creator>
      <dc:date>2022-09-21T17:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting all variables from the Qlikview application using macro</title>
      <link>https://community.qlik.com/t5/Member-Articles/Exporting-all-variables-from-the-Qlikview-application-using/tac-p/2506607#M2244</link>
      <description>&lt;P&gt;Thanks for your work&lt;BR /&gt;It works great with both apps attached.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 12:57:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/Exporting-all-variables-from-the-Qlikview-application-using/tac-p/2506607#M2244</guid>
      <dc:creator>yocrozet</dc:creator>
      <dc:date>2025-02-19T12:57:58Z</dc:date>
    </item>
  </channel>
</rss>

