<?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: If Then with Connect and Store in Water Cooler</title>
    <link>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677882#M3160</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK. something is weird. It sounds like connectivity is good but the SQL is bad.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my next suggestion. &lt;/P&gt;&lt;P&gt;1. Create a brand new QVW&lt;/P&gt;&lt;P&gt;2. Add a connect statement to the script&lt;/P&gt;&lt;P&gt;3. browse the data source and reselect the same table as before with all fields&amp;nbsp; (select * from &amp;lt;tablename&amp;gt;)&lt;/P&gt;&lt;P&gt;4. Test that the SQL runs fine&lt;/P&gt;&lt;P&gt;5. if it does , add a table name in&amp;nbsp; the line above the SQL statementfront as you have done like this:&amp;nbsp;&amp;nbsp; Table1:&lt;/P&gt;&lt;P&gt;6. rerun the sql.&lt;/P&gt;&lt;P&gt;&amp;gt; what happens&amp;nbsp; ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 30 Aug 2014 18:23:31 GMT</pubDate>
    <dc:creator>JonnyPoole</dc:creator>
    <dc:date>2014-08-30T18:23:31Z</dc:date>
    <item>
      <title>If Then with Connect and Store</title>
      <link>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677875#M3153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking for a solution that would allow me to connect to one of two data source and store the results in one QVD file. The data source is determined with an input box selection: PRO;ITG. Both have the exact same schema and support the same SQL. On a refresh the script would determine which source prior to executing the SQL. The resultant table would then be stored to a&amp;nbsp; QVD file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the what I expect the code to look like;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Test:&lt;/P&gt;&lt;P&gt;If InputSrc = 'PRO' Theb&lt;/P&gt;&lt;P&gt; CONNECT TO [....]&lt;/P&gt;&lt;P&gt;Else&lt;/P&gt;&lt;P&gt; CONNECT TO [...]&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;SQL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From mytable ;&lt;/P&gt;&lt;P&gt;STORE Test into Local.QVD;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the label the script returns an error of;&lt;/P&gt;&lt;P&gt;Unknown statement&lt;/P&gt;&lt;P&gt;Test:&lt;/P&gt;&lt;P&gt;if tSrc = 'PRO' then&lt;/P&gt;&lt;P&gt;&amp;nbsp; CONNECT TO [...]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With no label, the script returns an error of;&lt;/P&gt;&lt;P&gt;ErrorSource: OraOLEDB, ErrorMsg: ORA-00942: table or view does not exist&lt;/P&gt;&lt;P&gt;SQL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From mytable ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without the IF statement, the CONNECT and SQL Works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It appears that the label TEST required a CONNECT and STORE and does not allow a If statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this even possible or should I look at a different solution? Any recommendations welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 21:10:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677875#M3153</guid>
      <dc:creator>johncahillhp</dc:creator>
      <dc:date>2014-08-29T21:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: If Then with Connect and Store</title>
      <link>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677876#M3154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Does this work ?&amp;nbsp; Move the Test: to in front of the SQL. I added a preceding load in case you decide to manipulate the raw SQL data. optionally drop the test table if you don't need it anymore at the end of the script.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;If InputSrc = 'PRO' Theb&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;CONNECT TO [....]&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Else&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;CONNECT TO [...]&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;End If&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Test:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;load&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;*;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;SQL&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select *&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From mytable ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;STORE Test into Local.QVD;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;drop table Test;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 21:14:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677876#M3154</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-08-29T21:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: If Then with Connect and Store</title>
      <link>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677877#M3155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, the script returns the same error as if there were no label;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ErrorSource: OraOLEDB, ErrorMsg: ORA-00942: table or view does not exist&lt;/P&gt;&lt;P&gt;SQL&lt;/P&gt;&lt;P&gt;Select *&lt;/P&gt;&lt;P&gt;From mytable ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 21:23:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677877#M3155</guid>
      <dc:creator>johncahillhp</dc:creator>
      <dc:date>2014-08-29T21:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: If Then with Connect and Store</title>
      <link>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677878#M3156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And if you take out the if statement and leave just the correct CONNECT statement it all works correct ?&amp;nbsp; can you confirm and also paste the successful script here ?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that still works for you, i would use the 'debug' button option to step through the script line by line to ensure its evaluating the IF statement correctly and that the variable is set correctly. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 01:05:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677878#M3156</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-08-30T01:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: If Then with Connect and Store</title>
      <link>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677879#M3157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have checked through OLEDB, It is working fine. Here is the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF vInput = 1 then&lt;/P&gt;&lt;P&gt;&amp;nbsp; OLEDB CONNECT TO [Provider=MSDASQL.1;Persist Security Info=False;Extended Properties="DSN=MS Access Database;DBQ=E:\Ishfaque Ahmed\QlikView\mdb\TestDB\db1.mdb;DefaultDir=E:\Ishfaque Ahmed\QlikView\mdb\TestDB;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ELSE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; OLEDB CONNECT TO [Provider=MSDASQL.1;Persist Security Info=False;Extended Properties="DSN=MS Access Database;DBQ=E:\Ishfaque Ahmed\QlikView\mdb\TestDB\db2.mdb;DefaultDir=E:\Ishfaque Ahmed\QlikView\mdb\TestDB;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TestTbl:&lt;/P&gt;&lt;P&gt;SQL SELECT * FROM Account;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STORE TestTbl into C:\TestQVD.qvd (qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If need be, please let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Ishfaque Ahmed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 06:23:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677879#M3157</guid>
      <dc:creator>engishfaque</dc:creator>
      <dc:date>2014-08-30T06:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: If Then with Connect and Store</title>
      <link>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677880#M3158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jonathon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The if statement works correctly and successfully connects to the right data source. I am using the debug function to step through the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the successful script;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if tSrc = 'PRO' then&lt;/P&gt;&lt;P&gt;  CONNECT TO [Provider=OraOLEDB.Oracle.1;Persist Security Info=True;User ID=xxxxx;Data Source=xxx_PRO;Extended Properties=""] (XPassword is RBCEAUBOTbYIWQNOILMETZQEDC);&lt;/P&gt;&lt;P&gt;elseif tSrc = 'ITG' then&lt;/P&gt;&lt;P&gt;  CONNECT TO [Provider=OraOLEDB.Oracle.1;Persist Security Info=True;User ID=xxxxx;Data Source=xxx_ITG;Extended Properties=""] (XPassword is FeIYKUBOTbYGCRRNBbYWWPJGQJMEDDC);&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 14:32:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677880#M3158</guid>
      <dc:creator>johncahillhp</dc:creator>
      <dc:date>2014-08-30T14:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: If Then with Connect and Store</title>
      <link>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677881#M3159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Ishfaque and Jonathon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the correct syntax;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF tSrc = 'PRO' then&lt;/P&gt;&lt;P&gt;  OLEDB CONNECT TO [Provider=OraOLEDB.Oracle.1;Persist Security Info=True;User ID=xxxxx;Data Source=xxx_PRO;Extended Properties=""] (XPassword is RBCEAUBOTbYIWQNOILMETZQEDC);&lt;/P&gt;&lt;P&gt;ELSE&lt;/P&gt;&lt;P&gt;  OLEDB CONNECT TO [Provider=OraOLEDB.Oracle.1;Persist Security Info=True;User ID=xxxxx;Data Source=xxx_ITG;Extended Properties=""] (XPassword is FeIYKUBOTbYGCRRNBbYWWPJGQJMEDDC);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TestTbl:&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;              FROM  mytable&lt;/P&gt;&lt;P&gt;              where ROWNUM &amp;lt;= 5;&lt;/P&gt;&lt;P&gt;STORE TestTbl into C:\TestQVD.qvd (qvd);&lt;/P&gt;&lt;P&gt;drop table TestTbl;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 14:51:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677881#M3159</guid>
      <dc:creator>johncahillhp</dc:creator>
      <dc:date>2014-08-30T14:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: If Then with Connect and Store</title>
      <link>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677882#M3160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK. something is weird. It sounds like connectivity is good but the SQL is bad.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my next suggestion. &lt;/P&gt;&lt;P&gt;1. Create a brand new QVW&lt;/P&gt;&lt;P&gt;2. Add a connect statement to the script&lt;/P&gt;&lt;P&gt;3. browse the data source and reselect the same table as before with all fields&amp;nbsp; (select * from &amp;lt;tablename&amp;gt;)&lt;/P&gt;&lt;P&gt;4. Test that the SQL runs fine&lt;/P&gt;&lt;P&gt;5. if it does , add a table name in&amp;nbsp; the line above the SQL statementfront as you have done like this:&amp;nbsp;&amp;nbsp; Table1:&lt;/P&gt;&lt;P&gt;6. rerun the sql.&lt;/P&gt;&lt;P&gt;&amp;gt; what happens&amp;nbsp; ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 18:23:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677882#M3160</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-08-30T18:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: If Then with Connect and Store</title>
      <link>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677883#M3161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your diligence. The SQL was bad. It is working now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2014 11:45:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Water-Cooler/If-Then-with-Connect-and-Store/m-p/677883#M3161</guid>
      <dc:creator>johncahillhp</dc:creator>
      <dc:date>2014-09-02T11:45:59Z</dc:date>
    </item>
  </channel>
</rss>

