Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
Showing results for 
Search instead for 
Did you mean: 

calling subroutine in UI

I Want to call subroutine on click of a button on UI, 

Eg IF i click on East East Sub should run, if i click on Central then Central Sub should run like wise..

i don't want to comment uncomment each time in script.

i have attached just sample data in actual its complex script with diff headers conditions.


Labels (2)
3 Replies

Hey Gysbert Thanks for replay.

both the post good when we are loading same file or multiple files with same filtering.

good learning for me though this will not solve my problem.


my requirement is 

there 22-25 files i have to load each file has different headers & diff process of sanitizing the data   

means some may have required columns some may not have for some files will have to filter out some data some wont..  and all the files wont be available each time... like wise & so on...

currently i have created 22-25 QVWs to process each file. to get rid of opening of each file & running code

i want something centralize so that on a click of button or something which will run file no 1 or file no 10 or file no 25..... 


MVP & Luminary
MVP & Luminary

The "normal" way would be to use the Qlik server and to create appropriate tasks which runs all your qvw's in scheduled task-chains.

But you could use something like this to update all the qvw's you like:


sub AutomaticReload

dim doc,obj, iRow, app, path, newApp, newdoc
set doc = ActiveDocument
set obj = doc.GetSheetObject("TB01")

for iRow = 1 to obj.GetRowCount - 1
    set app = obj.GetCell(iRow, 0)
    set path = obj.GetCell(iRow, 1)

    set newApp = ActiveDocument.GetApplication
    set newdoc = newApp.OpenDoc (path.Text & app.Text,"","")

set obj = nothing
set app = nothing
set path = nothing
set newApp = nothing
set newdoc = nothing

end sub 


The routine just runs through a tablebox and reads from there the paths and filenames (you need to load them in any way maybe within an inline-load or an Excel or creates the list with a filelist() loop - with the needed order as far as there are any dependencies between them) and which open/reload/save/close one application after another.

It's quite simple but if you need several task-chains with dependencies and/or any kind of error-handling or some other advanced measures it could become quite difficult and a server-solution (with a publisher) might be far more suitable.

- Marcus