<?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 Macro to fetch AS400 data in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-to-fetch-AS400-data/m-p/219478#M72507</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;Does anyone have a working macro (not load script) that fetches data from an AS400? I need to collect a few bits of simple data dynamically for a user selection from a unique key within a single PF on the AS400 but have read things on ODBC vs ADO that make me question the approach.&lt;/P&gt;&lt;P&gt;I really would appreciate a working model rather than trying to re-invent the wheel.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gordon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Jul 2010 17:56:27 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-07-09T17:56:27Z</dc:date>
    <item>
      <title>Macro to fetch AS400 data</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-fetch-AS400-data/m-p/219478#M72507</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;Does anyone have a working macro (not load script) that fetches data from an AS400? I need to collect a few bits of simple data dynamically for a user selection from a unique key within a single PF on the AS400 but have read things on ODBC vs ADO that make me question the approach.&lt;/P&gt;&lt;P&gt;I really would appreciate a working model rather than trying to re-invent the wheel.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gordon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jul 2010 17:56:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-fetch-AS400-data/m-p/219478#M72507</guid>
      <dc:creator />
      <dc:date>2010-07-09T17:56:27Z</dc:date>
    </item>
    <item>
      <title>Macro to fetch AS400 data</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-fetch-AS400-data/m-p/219479#M72508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If of interest to anyone, here is my macro. The user will input a value using an input box tied to a variable vWSO and get the values&lt;BR /&gt;of 2 fields returned through the variables vJNSLSM and vJNSRNO.&lt;BR /&gt;Using 'Insert/Update' you should also be able to share data dynamically between users and a document....&lt;/P&gt;&lt;P&gt;sub GetData&lt;/P&gt;&lt;P&gt;' Fetch selection&lt;BR /&gt; set doc=ActiveDocument&lt;BR /&gt; vWSO = doc.Variables("vWSO").GetContent.String&lt;/P&gt;&lt;P&gt;' Open connection using System DSN&lt;BR /&gt; set conn = CreateObject("ADODB.Connection")&lt;BR /&gt; conn.ConnectionString = "DSN=AS400;Uid=myuserid;Pwd=mypassword;"&lt;BR /&gt; conn.Open&lt;BR /&gt;&lt;BR /&gt;' Create recordset (only one row will be returned as JNWORD = unique key)&lt;BR /&gt; query = "SELECT JNSLSM, JNSRNO FROM S0F040 WHERE JNWORD = " &amp;amp; vWSO&lt;BR /&gt; set rs = CreateObject("ADODB.Recordset")&lt;BR /&gt; set rs.ActiveConnection = conn&lt;BR /&gt; rs.Open query&lt;/P&gt;&lt;P&gt;' If successful set Qlikview variables to values in 1st row of recordset (1st field = 0) else initialise them&lt;BR /&gt; if conn.Errors.Count = 0 and not rs.EOF then&lt;BR /&gt; doc.Variables("vJNSLSM").SetContent rs.Fields(0).Value, false&lt;BR /&gt; doc.Variables("vJNSRNO").SetContent rs.Fields(1).Value, false&lt;BR /&gt; else&lt;BR /&gt; doc.Variables("vJNSLSM").SetContent "", false&lt;BR /&gt; doc.Variables("vJNSRNO").SetContent "", false&lt;BR /&gt; end if&lt;/P&gt;&lt;P&gt;' Tidy up&lt;BR /&gt; rs.Close&lt;BR /&gt; set conn = Nothing&lt;BR /&gt; set rs = Nothing&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gordon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jul 2010 11:47:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-fetch-AS400-data/m-p/219479#M72508</guid>
      <dc:creator />
      <dc:date>2010-07-13T11:47:15Z</dc:date>
    </item>
  </channel>
</rss>

