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

Create a personal function

Hi everyone!

I've been working with QV for some weeks and this is my first post.

I want to know how to stablish personal functions in QV to call them on Load part.

For example:

Function Calc (...);

Load Calc (Customer_type) as NewType

From qvd (qvd)

where Customer_type = 1;

Is possible to do this?

Thanks a lot

1 Solution

Accepted Solutions
rbecher
MVP
MVP

Hi,

you can only create personal functions in VB script which can be used in QV script.

function calc (ByVal customer_type)
... do something
calc = result
end function


But I would suggest always to try to use build in script functions first for performance reasons.

- Ralf

Astrato.io Head of R&D

View solution in original post

11 Replies
rbecher
MVP
MVP

Hi,

you can only create personal functions in VB script which can be used in QV script.

function calc (ByVal customer_type)
... do something
calc = result
end function


But I would suggest always to try to use build in script functions first for performance reasons.

- Ralf

Astrato.io Head of R&D
Not applicable
Author

For that performance reasons I prefer to do that in QV, but seems that it's not possible to do a function at the begining of the QV script to be called after.

Thank you, Ralf.

rbecher
MVP
MVP

You can do a lot of interesting things with QV mappings...

- Ralf

Astrato.io Head of R&D
Not applicable
Author

I think you can also do some kinf of function using sub() for example.

But in this case you can only do QV things such as calculate specific values in tables, create tables, update variables, etc..

Sébastien

Not applicable
Author

Sébastien, sub function seems good, but it's not possible to use "call" into load part.

"Load call function(parameter) as result_function From file.qvd (qvd)"

I want to do something like that...

Thanks! 🙂

Not applicable
Author

You're right but in some case you can do a loop and for each loop retrieve the result in a variable then use this variable in the field...

I don't know if it can be an easy solution comparing to vbs but why not..

rbecher
MVP
MVP

Pepe,

I found another way to do this in the forum: http://community.qlik.com/forums/p/18140/70878.aspx#70878

Also see the attached example udf.qvw!

- Ralf

Astrato.io Head of R&D
Not applicable
Author

No Attachments 😞

rbecher
MVP
MVP

follow the link...

Astrato.io Head of R&D