Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Open other instance of QlikView and make section access login

Hi everybody!

     I'm implementing a way to make an automatic login into a qvw file with section access, press a button and then close the file, or at least I'm trying to do so. I'm stuck because the only way that I found to actually pass through all the possible logins, or so I thought that it would pass through all logins, ended opening the file once and pressing the button X times (X = quantity of possible logins). Heres the code:

SUB GerarPDFUsuarios

    CreateObject("QlikTech.QlikView")

    set App = ActiveDocument.GetApplication

   

    'set Username = ActiveDocument.Variables("vUsuario")

    'set Password = ActiveDocument.Variables("vSenha")

    Set Table = ActiveDocument.GetSheetObject( "TB01" )

    For RowIter = 1 to table.GetRowCount-1            'LINHA                                                       

        set cell = table.GetCell(RowIter,ColIter)

        set cell2 = table.GetCell(RowIter,ColIter+1)

       

           set Username = cell

           set Password = cell2

       

        Set MyDoc = App.OpenDoc ("D:\Test.qvw", Username.text, Password.text)               

        Set Button1 = MyDoc.GetSheetObject("BU462")                                                              

       

        IF IsObject(Button1) THEN                                                                                'SE botão Existe Então

            Button1.Press                                                                                        'Botão é pressionado

        END IF

        'MyDoc.GetApplication.Quit   

        'ActiveDocument.Activate                                                                            'Fecha documento aberto.

        'MyDoc.CloseDoc

        Set MyApp = Nothing

       

    Next

END SUB

     The button print the report that I created inside Test.qvw.

     So basicaly what i'm trying to do is to loop through the logins, pressing the button to generate the PDF with what each user can see in the report.

     Any ideas to do it in another way?

Community Browser