Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to define a new function?

Hi all,

since I have a complex calculation that I reuse in charts, I would like to put into a variable the results of the calculation, but I would like to define dinamically the set of values of the fields on which to perform the calculation.

It looks like defining a new function: is it possible (perhaps using set Analysis in variable definition)?

Thanks in advance!

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can define a variable as an expression that uses parameter placeholders. See the section "Dollar-Sign Expansion with Parameters" in the Ref Guide.

For example

SET myfunc= $1 + $2;

$(myfunc(3,4)) = 7

See also the attached example from the QV Cookbook.

-Rob

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can define a variable as an expression that uses parameter placeholders. See the section "Dollar-Sign Expansion with Parameters" in the Ref Guide.

For example

SET myfunc= $1 + $2;

$(myfunc(3,4)) = 7

See also the attached example from the QV Cookbook.

-Rob

Not applicable
Author

Thanks a lot Rob!

It's very useful and very clear!

Roberta