Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use a JS or VBS function in Table Expression

Hello, i'm trying to call either a JScript or VBScript function in Pivot Table. Let's say i have a function called addFive(arg), and i want to use it to modify a column in the table by calling it, and give it an argument another column in the same table, and write the returned result in the column where i've called the function.

IE: in a table there is Units column, and i add a column named total in the table expressions, and i input the following as its definition: =addFive(Units), - (like sum(Units) but i want to implement my own function to communicate with external software).

Thanks in advance.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

It's not possible to call vb or js functions in expressions. You can put expressions in variables and pass parameters to variables. For example:

Create a variable vAddFive: $1+5

Use the variable in an expression passing Units as parameter: =$(vAddFive(Units))

This way you can build functions from expressions and variables. The first parameter is $1, the second $2 and so on.


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar

It's not possible to call vb or js functions in expressions. You can put expressions in variables and pass parameters to variables. For example:

Create a variable vAddFive: $1+5

Use the variable in an expression passing Units as parameter: =$(vAddFive(Units))

This way you can build functions from expressions and variables. The first parameter is $1, the second $2 and so on.


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you for the information. I have one more question. is it possible to assign a JSCript or VBScript function to that Variable, so i can use the function's result as variable's value?

Gysbert_Wassenaar

No. You can only use vb or js functions in the load script and in macro's.


talk is cheap, supply exceeds demand
Not applicable
Author

Ok, thank you for your time.