<?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: Macro to load data from a webservice in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-to-load-data-from-a-webservice/m-p/668470#M243006</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you put the above text in the script editor (Ctrl-E) or the module editor (Ctrl-M)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Jul 2014 00:23:46 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2014-07-29T00:23:46Z</dc:date>
    <item>
      <title>Macro to load data from a webservice</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-load-data-from-a-webservice/m-p/668469#M243005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: #002060;"&gt;Hello Friends,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Your helps are always appreciated!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;I am loading data from a web server, so I&amp;nbsp; have downloaded the below script from community to achieve the same&amp;nbsp; and while executing I am getting an error saying&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Expected ';'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;The script below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;sub GetWebServiceData()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt; Define the URL of the service&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;&lt;SPAN&gt;url = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://mywebservicesite.com/projets.xml"&gt;http://mywebservicesite.com/projets.xml&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' Define parameters to post (in this case will return data for all projects)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;request = "project_id=allprojects"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Set objHTTP = Createobject("MSXML2.ServerXMLHTTP")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;'Open channel&lt;/SPAN&gt;&lt;/P&gt;&lt;UL style="list-style-type: circle;"&gt;&lt;LI&gt;&lt;SPAN style="color: #002060;"&gt;objHTTP.open "POST", url, False&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' Send header&lt;/SPAN&gt;&lt;/P&gt;&lt;UL style="list-style-type: circle;"&gt;&lt;LI&gt;&lt;SPAN style="color: #002060;"&gt;objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' Send parameters&lt;/SPAN&gt;&lt;/P&gt;&lt;UL style="list-style-type: circle;"&gt;&lt;LI&gt;&lt;SPAN style="color: #002060;"&gt;objHTTP.send request&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' Get responce xml in string&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;responce = objHTTP.responseText&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Set objHTTP = Nothing&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' At this point web service responded and gave back the response xml (if there is no error)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' Common case is to return errors in xml format&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' Since the returned xml is in the memory we will need to store it in local file&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' Set folder name where file will be save&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;foldername = "C:\ProjectFiles"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' Set file name where data will be stored&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;filename = "xmlReponce.xml"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Set objFSO = CreateObject("Scripting.FileSystemObject")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' Check if folder exists else create it&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;If objFSO.FolderExists(foldername) Then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Set objFolder = objFSO.GetFolder(foldername)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Else&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Set objFolder = objFSO.CreateFolder(foldername)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;End If&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' Check if file exists else create it&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;If objFSO.FileExists(foldername &amp;amp; filename) Then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Set objFolder = objFSO.GetFolder(foldername)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Else&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Set objFile = objFSO.CreateTextFile(foldername &amp;amp; filename)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;End If&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;set objFile = nothing&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;set objFolder = nothing&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' Constant that indicate that file content will be overwritten and not appended&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Const ForAppending = 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' Open the text file&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Set objTextFile = objFSO.OpenTextFile (foldername &amp;amp; filename, ForAppending, True)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;' And paste the content&lt;/SPAN&gt;&lt;/P&gt;&lt;UL style="list-style-type: circle;"&gt;&lt;LI&gt;&lt;SPAN style="color: #002060;"&gt;objTextFile.WriteLine(responce )&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #002060;"&gt;objTextFile.Close&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;end function&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly let me know your opinions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #002060;"&gt;Kiru&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jul 2014 16:04:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-load-data-from-a-webservice/m-p/668469#M243005</guid>
      <dc:creator />
      <dc:date>2014-07-28T16:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to load data from a webservice</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-load-data-from-a-webservice/m-p/668470#M243006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you put the above text in the script editor (Ctrl-E) or the module editor (Ctrl-M)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2014 00:23:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-load-data-from-a-webservice/m-p/668470#M243006</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2014-07-29T00:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to load data from a webservice</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-load-data-from-a-webservice/m-p/668471#M243007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your time; I put the above code in module editor(Ctrl+M)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kiru&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2014 12:44:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-load-data-from-a-webservice/m-p/668471#M243007</guid>
      <dc:creator />
      <dc:date>2014-07-29T12:44:03Z</dc:date>
    </item>
  </channel>
</rss>

