Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
martinsuske
Partner - Contributor II
Partner - Contributor II

VBScript Function Call from Script (QV12.20)

Hi all,

I have a problem calling VBScript functions in my load script.

Using the example code from the qlik help I get the same error:

Script:

let MaxPop=VBin('Max population in millions :');

Syntax error

Unexpected token: '(', expected one of: ':', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', 'like', ...

let MaxPop=VBin>>>>>>(<<<<<<'Max population in millions :')

I'm using QlikView Desktop 12.20 (Nov 2017)

Any ideas?

Best regards,

Martin

5 Replies
eldro
Contributor
Contributor

I experience the same problem with 12.20. Sorry for not helping out with a solution but maybe it helps to push the topic a bit further for this common use case. I tried to replace (..) with {..}, [..] and eventually rewriting the line to call VBin() but nothing helps. The only hint that Qlikview sees VBin as a VBScript function is the syntax highlighting deminishes as soon as the function is renamed to something like VBin2 in the VBScript editor but not in the QV script.

Maybe we miss out a new security setting?

Anonymous
Not applicable

HI, I have the same issue:

function:

function Somma(x, y) {

     Somma=a+b

}

script:

IF Somma(2, 3)  = 5THEN

     TRACE("OK");

ELSE

     TRACE("KO");

ENDIF

It doesn't work: Unexpected token: '(', expected one of: ':', 'OPERATOR_PLUS', 'OPERATOR_MINUS'...


Can someone help us?

martinsuske
Partner - Contributor II
Partner - Contributor II
Author

I just found this thread Executing Jscript function during load statement

which suggests turning off the new BNF mode by adding ///$bnf off as first line of the script.


Works for me.

eldro
Contributor
Contributor

Thanks, that does the trick!

Just a hint:   >///$bnf off< belongs to the very first line of the Qlikview script (I tried the module script at first ..)


alesanti‌: The signature of your Somma function uses x,y but returns a,b -> took some time to figure that out




Anonymous
Not applicable

It works also for me!

Thank you Martin!

Yes Eric, my mistake, I write down quickly.