Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Connecting to multiple OLE DB servers with a loop.

Hello all,

I am trying to run the same load script on multiple database servers without having several OLE connection strings with the same load statement copied / pasted.  This of course makes changes to the load script difficult to manage.  I would like to store the server names in a external file (excel?), and then execute the load using a server name variable in the connection string with a loop for each server name listed.  To keep the results seperate for each server, I will store the results by appending the server name variable to the file qvd file name.

Any ideas on how to pull off the loop?

Thanks in advance.

2 Replies
MVP & Luminary
MVP & Luminary

Re: Connecting to multiple OLE DB servers with a loop.

This is an example for different databases in multiple subfolders, but the logic should also worked in your case:

for each varPath in 'folder1', 'folder2'

     ODBC CONNECT32 TO [Microsoft Access-Datenbank;DBQ=D:\$(varPath)\Datenbank.mdb];

     table:

     Select ...

     DISCONNECT;

Next

- Marcus

Not applicable

Re: Connecting to multiple OLE DB servers with a loop.

I got it working using something similar.  Thanks Marcus.

Community Browser