Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.


Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Return Value in a SUBroutine

is ther any possibility to declare an own Sub like:

sub isACoolName(name)

//return -1 or 0


and then use it in if expressions: if isACoolName('JanUlrich') then .... ??

and how does such an return statemant have to look like?


4 Replies

Return Value in a SUBroutine


    Try this.

sub isACoolName(name)

isACoolName =1



Kaushik Solanki

Not applicable

Return Value in a SUBroutine

okey, thanks. But i still got a problem with writing the return value into a variable or use it in another way.

things like this:

a = isACoolName('test');


a = call isACoolName("test");

dont seem to work.

thanks for your input!

Contributor II

Return Value in a SUBroutine


You can't return values from subroutines.  You might like try using a $-sign expansion, though.  e.g.

SET isACoolName=('$1'='janulrich');

LET a=$(isACoolName('John'));

Not applicable

Return Value in a SUBroutine

Managing return values from SUB are possible in this way:

1) define a INLINE table VAR - it is used like a collection in VB or JavaScript
LOAD * INLINE [ Name, Val, Dummy_Var, 42 ]

2) create service functions to add or delete records in VAR
return values in SUBs can be stored in VAR with an Var_Add() or you can store directly with an LOAD * INLINE
Name, Val, ReturnVal, $(xyValue)

3) in main-pgm use LOOKUP to read the content of the Variable

- initial effort to create service routines
- not very transparent

- array() are possible
- unlimited record structure as you can create more fields in VAR  Inline
- the INLINE table is a normal table which can be used in your app to display your VAR-records