<?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 paths in variables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176727#M381851</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The folder structure is as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/131744_pastedImage_0.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Qlikview file containing the macro code for reducing data is present in folder B.&lt;/P&gt;&lt;P&gt;The folder Application contains the qvw file to be reduced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the vbscript, I have given the relative path as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dim vTest&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vTest= "..\A\ABC\Application\Reduce_data.qvw" &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use the absolute path in the code, then it runs fine without giving any error. Whereas if relative path Is given, it throws an error as Object required : 'MyDoc' at the line "MyDoc.ReduceData"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VBscript code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function ReduceData(vFilePath)&lt;BR /&gt; &lt;BR /&gt; Set MyApp = CreateObject("QlikTech.QlikView")&lt;BR /&gt; Set MyDoc = MyApp.OpenDocEx(vFilePath,0,False)&lt;BR /&gt; MyDoc.ReduceData&lt;BR /&gt; MyDoc.SaveAs(vFilePath)&lt;BR /&gt; MyDoc.CloseDoc&lt;BR /&gt; Set MyApp = Nothing&lt;BR /&gt; end Function&lt;BR /&gt; &lt;BR /&gt; 'ITP Dashboard&lt;BR /&gt; sub Test&lt;BR /&gt; dim vTest&lt;BR /&gt; vTest= "..\A\ABC\Application\Reduce_data.qvw"&lt;BR /&gt; call ReduceData(vTest)&lt;BR /&gt; end sub &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help me with the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Asma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jul 2016 07:38:39 GMT</pubDate>
    <dc:creator>riyazasma1009</dc:creator>
    <dc:date>2016-07-19T07:38:39Z</dc:date>
    <item>
      <title>Using relative paths in variables</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176725#M381849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a vbscript which performs the action of reducing data(File - &amp;gt; Reduce Data -&amp;gt; Select Possible).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set MyApp = CreateObject("QlikTech.QlikView")&lt;BR /&gt; Set MyDoc = MyApp.OpenDocEx(vFilePath,0,False)&lt;BR /&gt; MyDoc.ReduceData&lt;BR /&gt;MyDoc.SaveAs(vFilePath)&lt;BR /&gt; MyDoc.CloseDoc&lt;BR /&gt; Set MyApp = Nothing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vFilePath contains the absolute file path of the qvw to be reduced. The issue here is the above code does not work when relative paths are used in vFilePath whereas it works perfectly fine for absolute paths.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone please help me with the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Asma&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jul 2016 10:00:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176725#M381849</guid>
      <dc:creator>riyazasma1009</dc:creator>
      <dc:date>2016-07-18T10:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative paths in variables</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176726#M381850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;AFAIK relative paths do work in vbs. Therefore I think that your relative path isn't correct and/or the syntax isn't right and you might need additionally double-quotes around the path.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jul 2016 11:15:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176726#M381850</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-07-18T11:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative paths in variables</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176727#M381851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The folder structure is as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/131744_pastedImage_0.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Qlikview file containing the macro code for reducing data is present in folder B.&lt;/P&gt;&lt;P&gt;The folder Application contains the qvw file to be reduced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the vbscript, I have given the relative path as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dim vTest&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vTest= "..\A\ABC\Application\Reduce_data.qvw" &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use the absolute path in the code, then it runs fine without giving any error. Whereas if relative path Is given, it throws an error as Object required : 'MyDoc' at the line "MyDoc.ReduceData"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VBscript code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function ReduceData(vFilePath)&lt;BR /&gt; &lt;BR /&gt; Set MyApp = CreateObject("QlikTech.QlikView")&lt;BR /&gt; Set MyDoc = MyApp.OpenDocEx(vFilePath,0,False)&lt;BR /&gt; MyDoc.ReduceData&lt;BR /&gt; MyDoc.SaveAs(vFilePath)&lt;BR /&gt; MyDoc.CloseDoc&lt;BR /&gt; Set MyApp = Nothing&lt;BR /&gt; end Function&lt;BR /&gt; &lt;BR /&gt; 'ITP Dashboard&lt;BR /&gt; sub Test&lt;BR /&gt; dim vTest&lt;BR /&gt; vTest= "..\A\ABC\Application\Reduce_data.qvw"&lt;BR /&gt; call ReduceData(vTest)&lt;BR /&gt; end sub &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help me with the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Asma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2016 07:38:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176727#M381851</guid>
      <dc:creator>riyazasma1009</dc:creator>
      <dc:date>2016-07-19T07:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative paths in variables</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176728#M381852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have had now a look on google to relative paths within vbs and it seems that there is no native way to execute them. What I have found are various kinds of workarounds to generate a fullpath and here is one possible solution adapted to qlikview:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub Test&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dim vTest, vFolderCount&lt;/P&gt;&lt;P&gt;vTest= "\applications other\calendar4-5-4.qvw"&lt;/P&gt;&lt;P&gt;vFolderCount = len(vTest) - len(replace(vTest, "\", ""))&lt;/P&gt;&lt;P&gt;vTest = ActiveDocument.evaluate("left(DocumentPath(), index(DocumentPath(), '\', " &amp;amp; -vFolderCount &amp;amp; ") - 1)") &amp;amp; vTest&lt;/P&gt;&lt;P&gt;msgbox vTest&lt;/P&gt;&lt;P&gt;call ReduceData(vTest)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end sub &lt;/P&gt;&lt;P&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, 19 Jul 2016 16:03:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176728#M381852</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-07-19T16:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative paths in variables</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176729#M381853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Marcus for the quick reply!&lt;/P&gt;&lt;P&gt;The VB Code is working as expected.&lt;/P&gt;&lt;P&gt;I just need a small clarification. Could you please explain what does the below line of code mean:&lt;/P&gt;&lt;P&gt;vTest = ActiveDocument.evaluate("left(DocumentPath(), index(DocumentPath(), '\', " &amp;amp; -vFolderCount &amp;amp; ") - 1)") &amp;amp; vTest&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Asma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2016 06:40:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176729#M381853</guid>
      <dc:creator>riyazasma1009</dc:creator>
      <dc:date>2016-07-20T06:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative paths in variables</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176730#M381854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The logic is to read the full-path from the current script and cut the right-part to the x-number of backslashes (counted before in vFolderCount) and then adding the used relative-part which is then together a valid full-path again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The backslash-counting is done here in vbs because it's quite simple with len + replace. To cut a string to a variable point isn't so easy in vbs and therefore it's done with qlikview-functions called per evaluate().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2016 06:56:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176730#M381854</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-07-20T06:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using relative paths in variables</title>
      <link>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176731#M381855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Marcus!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2016 06:57:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-relative-paths-in-variables/m-p/1176731#M381855</guid>
      <dc:creator>riyazasma1009</dc:creator>
      <dc:date>2016-07-20T06:57:56Z</dc:date>
    </item>
  </channel>
</rss>

