Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

1 Reply
john_novello
New Contributor II

Re: Sub Routine Parameters

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

Community Browser