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;]"
and in the load I do
CONNECT TO $(vConnString);
And so I can work on vConnString later in script, and recall the connection if needed.
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.
Cheers for that.
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.
Array = Split(sConnectionString, ";")
Then Loop Array
Until LEFT(String, LEN("Initial Catalog=")) = "Initial Catalog="
Then Grab the text LEFT of Initial Catalog= i.e. myDBName
I guess I'm just not that good at writing code in QlikView yet.
Would love some string manipulation examples if they exist.
Oh sorry, I haven't understood the issue.
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.
vConnectionString = '[Integrated Security=XXXX;Persist Security Info=False;Initial Catalog=myDBName;Data Source=MyServer;Provider=SQLOLEDB.1;]'; Tmp1: Load '$(vConnectionString)' As CONNECTION_STRING AutoGenerate(1); Tmp2: Load subfield(rtrim(ltrim(mid(CONNECTION_STRING,2,len(CONNECTION_STRING)-2))), ';') As PARAMETER resident Tmp1; Tmp3: Load PARAMETER, rtrim(ltrim(mid(PARAMETER, 1, Index(PARAMETER, '=')-1))) As PARAMETER_NAME, rtrim(ltrim(mid(PARAMETER, Index(PARAMETER, '=')+1, len(PARAMETER)-Index(PARAMETER, '=')))) As PARAMETER_VALUE resident Tmp2;