<?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>topic Re: Using relative path in macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909575#M653421</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Muzamir, there is a property of the document with the path, maybe you can work with that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set docprop = ActiveDocument.GetProperties&lt;/P&gt;&lt;P&gt;msgbox(docprop.FileName)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will return path and filename of the document.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Aug 2015 10:19:32 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2015-08-04T10:19:32Z</dc:date>
    <item>
      <title>Using relative path in macro</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909573#M653419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;What I am trying to achieve:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I created a button that will allow me to export activated charts to a folder. So i name this folder Exports and use relative paths for convenience sake because I intend to put it on server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What i tried:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;There is no issue exporting it using the absolute path that has been commented out below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What i know:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; the syntax "..\" basically goes one folder higher.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Current Dashboard path:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;C:\Users\muzamirnasir\Desktop\ACGME-I Survey\Dashboard&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I cannot seem to get the relative path to work.Nothing is exported, even if it is wrong, the file should still be somewhere. It seems to work for "STORE" on another dashboard.&lt;/P&gt;&lt;P&gt;What did i miss out? Is there a way out of this? Any examples? Is it ExportBitMapToFile?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I currently coded this out on Macro..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'Export for Details tab&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SUB SaveBitmapDetails&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'SET obj = ActiveDocument.GetSheetObject("CH87")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;'obj.ExportBitmapToFile "C:\Users\muzamirnasir\Desktop\ACGME-I Survey\Exports\CH87.jpg"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET obj = ActiveDocument.GetSheetObject("CH75")&lt;/P&gt;&lt;P&gt;obj.ExportBitmapToFile "..\..\Exports\CH75.jpg"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;END SUB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2015 08:28:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909573#M653419</guid>
      <dc:creator />
      <dc:date>2015-08-04T08:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative path in macro</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909574#M653420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is not possible to use relative paths within vbscript directly - you will need to build an own logic, see here various approaches to get it: &lt;A href="https://www.google.de/search?q=vbscript+relative+path" title="https://www.google.de/search?q=vbscript+relative+path"&gt;https://www.google.de/search?q=vbscript+relative+path&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2015 10:11:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909574#M653420</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-08-04T10:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative path in macro</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909575#M653421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Muzamir, there is a property of the document with the path, maybe you can work with that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set docprop = ActiveDocument.GetProperties&lt;/P&gt;&lt;P&gt;msgbox(docprop.FileName)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will return path and filename of the document.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2015 10:19:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909575#M653421</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2015-08-04T10:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative path in macro</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909576#M653422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am sure it will come in handy but i still need the relative path. Currently, im just using an absolute path which can inefficient.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2015 06:32:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909576#M653422</guid>
      <dc:creator />
      <dc:date>2015-08-05T06:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative path in macro</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909577#M653423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Almost there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;set mypath = ActiveDocument.GetProperties&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;' Has no "\" at the end&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;curDir = mypath.MyWorkingDirectory&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;msgbox(curDir)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;relativeDir = curDir &amp;amp; "\..\ThisDirIsRelative"&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;msgbox(relativeDir)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Aug 2016 02:14:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909577#M653423</guid>
      <dc:creator />
      <dc:date>2016-08-04T02:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative path in macro</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909578#M653424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using relative paths in VBScript works in my QV 11.20 installation, but not in QV 12.0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tested a little using the following VBScript function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Function&lt;/STRONG&gt; VBWorkingDir&lt;/P&gt;&lt;P&gt;&amp;nbsp; Dim fso&lt;/P&gt;&lt;P&gt;&amp;nbsp; Set fso = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;&amp;nbsp; VBWorkingDir = fso.GetAbsolutePathName(".")&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;End Function&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function returns my application(qvw) directory in 11.20, but in 12.0 it returns "D:\Program Files\QlikView"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I use my VBScript function in the QV load script to initialize variables, performance doesn't matter and I can expand relative paths like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FOR EACH&lt;/STRONG&gt; v.Logfile &lt;STRONG&gt;IN&lt;/STRONG&gt; filelist ( '..\logdir\myapp.log' );&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NEXT&lt;/STRONG&gt; v.Logfile // EmptyFOR EACH loop to convert relative filename to full path&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Feb 2017 19:15:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909578#M653424</guid>
      <dc:creator />
      <dc:date>2017-02-20T19:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative path in macro</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909579#M653425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;A workaround&lt;/STRONG&gt; is to use a function to set the working directory of the VBScript engine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;' VBScript:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;On Error Resume Next&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;SPAN style="color: #008000;"&gt;' Should go to the top of your script&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Function&lt;/STRONG&gt; VBSetWorkingDir(dirPath)&lt;/P&gt;&lt;P&gt;&amp;nbsp; Dim objShell&lt;/P&gt;&lt;P&gt;&amp;nbsp; Set objShell = CreateObject("Wscript.Shell")&lt;/P&gt;&lt;P&gt;&amp;nbsp; objShell.CurrentDirectory = dirPath&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; VBSetWorkingDir = Err.Description&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;End Function&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;// QlikView Script:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;LET&lt;/STRONG&gt;&lt;/SPAN&gt; v.ErrorMsg = &lt;SPAN style="font-size: 13.3333px;"&gt;VBSetWorkingDir(Text(QvWorkPath));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;Further comment&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If I knew how to access &lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;QvWorkPath&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;from VBScript I could have put the code in the initialization part of VBScript, then you would not need to call any function before using relative paths.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Feb 2017 20:40:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909579#M653425</guid>
      <dc:creator />
      <dc:date>2017-02-20T20:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative path in macro</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909580#M653426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hans,&lt;/P&gt;&lt;P&gt;Are you wanting to use the QvWorkPath during reload or from the UI? A caution on QvWorkPath: QvWorkPath is set at the end of script execution. The QvWorkPath you get during reload is from the last execution. If you move a file, QvWorkPath will not be correct in the first reload. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://masterssummit.com" rel="nofollow" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com" rel="nofollow" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Feb 2017 23:32:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-path-in-macro/m-p/909580#M653426</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2017-02-20T23:32:23Z</dc:date>
    </item>
  </channel>
</rss>

