<?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: Find Datasource info In String in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Find-Datasource-info-In-String/m-p/252386#M707337</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh sorry, I haven't understood the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can try this code that will create a table with the parameters and their values. You can modify this code if you prefer to have all the parameters in columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;vConnectionString = '[Integrated Security=XXXX;Persist Security Info=False;Initial Catalog=myDBName;Data Source=MyServer;Provider=SQLOLEDB.1;]';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tmp1:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;'$(vConnectionString)' As CONNECTION_STRING&lt;/P&gt;&lt;P&gt;AutoGenerate(1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tmp2:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;subfield(rtrim(ltrim(mid(CONNECTION_STRING,2,len(CONNECTION_STRING)-2))), ';') As PARAMETER&lt;/P&gt;&lt;P&gt;resident Tmp1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tmp3:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;PARAMETER,&lt;/P&gt;&lt;P&gt;rtrim(ltrim(mid(PARAMETER, 1, Index(PARAMETER, '=')-1))) As PARAMETER_NAME,&lt;/P&gt;&lt;P&gt;rtrim(ltrim(mid(PARAMETER, Index(PARAMETER, '=')+1, len(PARAMETER)-Index(PARAMETER, '=')))) As PARAMETER_VALUE&lt;/P&gt;&lt;P&gt;resident Tmp2;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Jan 2012 08:08:23 GMT</pubDate>
    <dc:creator>nstefaniuk</dc:creator>
    <dc:date>2012-01-18T08:08:23Z</dc:date>
    <item>
      <title>Find Datasource info In String</title>
      <link>https://community.qlik.com/t5/QlikView/Find-Datasource-info-In-String/m-p/252383#M707334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically want to get the Initial Catalogue value from the connection string in the Load Script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We set the Connection String in a file then use include which basically drops the contents of the file into the Load Script. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(Include=$(vConnectionFilePath));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For another feature I need to know the initial catalogue and maybe the Data Source name too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET sConnString = $(Include=$(vConnectionFilePath));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e. sConnString would equal &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONNECT TO [Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=myDBName;Data Source=MyServer;Provider=SQLOLEDB.1;]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to extract myDBName and MyServer from this variable string in the Load Script itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I split and loop through the string?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jan 2012 07:13:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Find-Datasource-info-In-String/m-p/252383#M707334</guid>
      <dc:creator />
      <dc:date>2012-01-05T07:13:27Z</dc:date>
    </item>
    <item>
      <title>Find Datasource info In String</title>
      <link>https://community.qlik.com/t5/QlikView/Find-Datasource-info-In-String/m-p/252384#M707335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi. I use the same technic but in hte file I have "Let vConnString = [Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=myDBName;Data Source=MyServer;Provider=SQLOLEDB.1;]"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in the load I do&lt;/P&gt;&lt;P&gt;$(Include=$(vConnectionFilePath));&lt;/P&gt;&lt;P&gt;CONNECT TO $(vConnString);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And so I can work on vConnString later in script, and recall the connection if needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The dangerous part of this method is that the connection string is stored in the application and so users can see the connection string and use it in a local Qlikview. So we use 2 applications : 1 for load and 1 for display or we "clean" connection strings at the end of the string.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jan 2012 07:57:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Find-Datasource-info-In-String/m-p/252384#M707335</guid>
      <dc:creator>nstefaniuk</dc:creator>
      <dc:date>2012-01-05T07:57:52Z</dc:date>
    </item>
    <item>
      <title>Find Datasource info In String</title>
      <link>https://community.qlik.com/t5/QlikView/Find-Datasource-info-In-String/m-p/252385#M707336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cheers for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually it's not an issue getting it as a string but really what I wanted was some code to strip the Initial Catalogue value out of the connection string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Array = Split(sConnectionString, ";")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then Loop Array&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Until LEFT(String, LEN("&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #ffffff;"&gt;Initial Catalog=")) = "&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #ffffff;"&gt;Initial Catalog="&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-size: 12px; background-color: #ffffff; font-family: Arial;"&gt;Then Grab the text LEFT of &lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #ffffff;"&gt;Initial Catalog= i.e. myDBName&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess I'm just not that good at writing code in QlikView yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would love some string manipulation examples if they exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2012 04:15:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Find-Datasource-info-In-String/m-p/252385#M707336</guid>
      <dc:creator />
      <dc:date>2012-01-11T04:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Find Datasource info In String</title>
      <link>https://community.qlik.com/t5/QlikView/Find-Datasource-info-In-String/m-p/252386#M707337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh sorry, I haven't understood the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can try this code that will create a table with the parameters and their values. You can modify this code if you prefer to have all the parameters in columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;vConnectionString = '[Integrated Security=XXXX;Persist Security Info=False;Initial Catalog=myDBName;Data Source=MyServer;Provider=SQLOLEDB.1;]';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tmp1:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;'$(vConnectionString)' As CONNECTION_STRING&lt;/P&gt;&lt;P&gt;AutoGenerate(1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tmp2:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;subfield(rtrim(ltrim(mid(CONNECTION_STRING,2,len(CONNECTION_STRING)-2))), ';') As PARAMETER&lt;/P&gt;&lt;P&gt;resident Tmp1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tmp3:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;PARAMETER,&lt;/P&gt;&lt;P&gt;rtrim(ltrim(mid(PARAMETER, 1, Index(PARAMETER, '=')-1))) As PARAMETER_NAME,&lt;/P&gt;&lt;P&gt;rtrim(ltrim(mid(PARAMETER, Index(PARAMETER, '=')+1, len(PARAMETER)-Index(PARAMETER, '=')))) As PARAMETER_VALUE&lt;/P&gt;&lt;P&gt;resident Tmp2;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jan 2012 08:08:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Find-Datasource-info-In-String/m-p/252386#M707337</guid>
      <dc:creator>nstefaniuk</dc:creator>
      <dc:date>2012-01-18T08:08:23Z</dc:date>
    </item>
    <item>
      <title>Find Datasource info In String</title>
      <link>https://community.qlik.com/t5/QlikView/Find-Datasource-info-In-String/m-p/252387#M707338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent. Works beautifully. Thanks for that!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2012 01:04:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Find-Datasource-info-In-String/m-p/252387#M707338</guid>
      <dc:creator />
      <dc:date>2012-01-19T01:04:46Z</dc:date>
    </item>
  </channel>
</rss>

