Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to return a parameter value from QlikView subroutine

Hi ,

      We need to get number of days in a month for this I am planning to write a subroutine which can be used in other places aswell. I am just looking for a function like below:

<Return Param>SUB(vMonthCount ,vYear)

IF(vMonthCount = 2) THEN

                              IF(MOD($(vYear),4) = 0 and MOD($(vYear),100) <> 0 or MOD($(vYear),400) = 0) THEN

                                        LET vMonthEndDay =28;

                              ELSE

                                 LET vMonthEndDay =29;

                              END IF

                     IF ($(vMonthCount)=1 OR $(vMonthCount)=3)

                               LET vMonthEndDay =31;

                              ELSEIF

                               LET vMonthEndDay =30;

END IF

     END SUB

Thanks

Dasu.G

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

There is no return value -- like Function -- available from SUB. What you can do is pass the name of a variable to to be set by the SUB. For example:

SUB DayCount(vMonthCount ,vYear, vMonthEndDay )

...

END SUB

CALL DayCount('2', '2013', vMyVar);

On return vMyVar=28

-Rob