Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Not applicable

Sub Routine Parameters

Hi all

I am using a sub routine to populate the facts table that I have in a QlikView report, and the parameters that are passed in to the routine are the existing table and field names that contain the data required.

The problem is that not every field in the facts table needs to be populated each time the sub routine is called, but the script fails when I try to pass Null() as one of the parameters.

Here is the subroutine

SUB loadFacts (employRef, sysID, measureID, calendarDate, groupType, metricType, factValue, tableName)

[$(employRef)] AS EMPLOY_REF
[$(sysID)] AS SYS_ID

   ,[$(measureID)] AS MEASURE_INDEX
[$(calendarDate)] AS CalendarDate
AS GroupType
AS MetricType
$(factValue) AS FactValue

END Sub;

Then I call the subroutine

CALL loadfacts ('EMPLOY_REF', 'SYS_ID', 'MEASURE_INDEX', 'DateCompleted', 'Install', 'Install', 1, 'tblWages');

The problem I have is that 'MEASURE_INDEX' is not always needed, so I would like this field to be Null() when then is the case.

Can anyone advise how I can do this.  Also, if anyone can give advice on when square/round brackets and quotations are required then that would be appreciated as I am new to sub routines in QlikView.


2 Replies
New Contributor II

Re: Sub Routine Parameters

I'm working on a similar problem.  Were you able to resolve this? Thanks

New Contributor

Re: Sub Routine Parameters

you should add another parameter which says if it is nesscesary, when it does'nt use as an if then null...