1 Reply Latest reply: Aug 20, 2014 7:10 AM by Marcus Sommer RSS

    For-Loop only loads first row of Excel, rows are db names, used in connect string.

    Alam Nizami

      This is what I have so far, I am trying to make it get each row for the database column and pass it one by one to the connections string. But it picks the first one and connects to that first database and loads the same data over and over. How can I fix it so that it moves to the next row to pick the correct data from that database.

      // fill variable with field values row by row

      For i = 0 To NoOfRows('ANProjects')-1

        let vDatabaseName=peek('DatabaseName', $(i));

        let vProjectName=peek('ProjectName', $(i));

        trace $(vDatabaseName)  $(vProjectName);


        // .......... use connection string ???   // Added the new variable from the for loop.

        OLEDB CONNECT32 TO [Provider=ABCDEDB.1;Persist Security Info=True;User ID=BI_QLIKVIEW;Initial Catalog=$(vDatabaseName);Data Source=ABCD1P;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=00000;Use Encryption for Data=False;Tag with column collation when possible=False] (XPASsword is BLANK);

      Note: My Table after this connects to a table name which is the same in each database. but each have different amount of row data in the sql database.