A Subroutine is Qlik Script’s answer to methods / functions / etc. from other scripting / programming languages

Basic Syntax

// There are NO typings necessary in Qlik.
SUB SubRoutineName(mOptionalArgument1,mOptionalArgument2)
/*
	Doc String area
 
	Args:
	- mOptionalArgument1 - 
	- mOptionalArgument2 - 
*/
 
// Do not forget the ';'
END SUB;

Returning from Subroutines

Qlik does not have the concept of Scope. Everything is global.

Therefore, a variable can be used to ‘return’ from a subroutine

Examples

Qlik Subroutines Example Collection

Check Qlik Meta Subroutine Categories for a breakdown of example subroutines