1 Reply Latest reply: Sep 2, 2014 12:16 PM by John Novello RSS

    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.