Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.


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

VBScript FunctionCalls VS QlikView CallSub

I've found a great difference between vbscript loop execution and script loop execution.

And ...

The fastest is not what i thougth !

Let's try :

In the module part , create a function doing an interation and some work:

In the loadscript : have a log function , have a QlikView Script loop sub, disable writing to the log

Call the vbScript loop Function

Call the QlikView Script loop Function

rem Module Function

function fBoucle ( vIndice, vDebut, vFin, vPas )

vNbCellules = Clng (( vFin-vDebut)/vPas)

execute "dim vTmpArray ( " & vNbCellules & ")"

    for vIndice = vDebut To vFin step vPas

        vTmpArray( ( vIndice - vDebut ) / vPas ) = vIndice




end function


sub trace_temps(Message )

let vTemps=Date( Now(),'YYYYMMDD hh:mm:ss');

    trace $(vTemps) : $(Message);

end sub

//QlikView Loop Sub

sub ssBoucle ( vIndice, vDebut, vFin, vPas )

let az=0;

    for vIndice = vDebut To vFin step vPas

        az= vIndice;


end sub;

//About 2 second for 10000000 iterations

call trace_temps('Debut fBoucle' );

let tmp= fBoucle ( 0, 1, 100000, 1);

trace $(tmp);

call trace_temps('Fin fBoucle' );

//About 4 second for 25000 iterations

call trace_temps('Debut ssBoucle' );

call ssBoucle ( 0, 1, 25000, 1);

call trace_temps('Fin ssBoucle' );

When the work is different, and we can't do the same, it's sound to me that calling vbscript function is not so bad