Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
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

    next

fBoucle=join(vTmpArray,"#")

fBoucle="TestWithWorkDone"

end function

//LogFunction:

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;

    next;

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

0 Replies