Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Can't create macro user defined function

I'm trying to create a macro user-defined function like this thread:

https://community.qlik.com/thread/115191

Function addTheseForMe(var1, var2)

addTheseForMe= var1+var2

End Function

However, when I try to run this in script:

LET varA = 7;

LET varB = 8;

LET varAB = addTheseForMe(varA, varB);

I get this error:

Syntax error

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

LET varAB = addTheseForMe>>>>>>(<<<<<<varA, varB)

What is wrong?

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

You're falling foul of the new BNF "strict" mode in QV12. You can disable this with the folowing line at the top of your script:

///$bnf off


You can turn off this feature for all apps on the machine by updating the settings.ini file - add this line

EnableBnfReload=0


(You can also switch this off from the settings easter egg. Click Help|About and right click the Qlikview icon in the bottom left corner. Find 'EnableBnfReload' and set it to zero).

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

You're falling foul of the new BNF "strict" mode in QV12. You can disable this with the folowing line at the top of your script:

///$bnf off


You can turn off this feature for all apps on the machine by updating the settings.ini file - add this line

EnableBnfReload=0


(You can also switch this off from the settings easter egg. Click Help|About and right click the Qlikview icon in the bottom left corner. Find 'EnableBnfReload' and set it to zero).

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

That solved the problem. Thanks very much.

hansrokers
Contributor III
Contributor III

In 12.30 this solution does not work anymore as NBF cannot be disabled.

Are user defined functions not possible anymore or is there another solution? 

userid128223
Creator
Creator

whats the solution for version 12.4 since BNF cannot be disabled.