Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
May 18th 10AM ET, Live Chat, bring your QlikView questions. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
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)


factTable:
LOAD
  
[$(employRef)] AS EMPLOY_REF
   ,
[$(sysID)] AS SYS_ID

   ,[$(measureID)] AS MEASURE_INDEX
   ,
[$(calendarDate)] AS CalendarDate
   ,'$(groupType)'
AS GroupType
   ,'$(metricType)'
AS MetricType
   ,
$(factValue) AS FactValue
Resident
  
$(tableName);

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.

Thanks

2 Replies
john_novello
Contributor II
Contributor II

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

hades
Contributor
Contributor

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