Focal Point
[CLOSED] User Defined Function

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4007054806

August 16, 2011, 11:02 AM
Dan Pinault
[CLOSED] User Defined Function
Hi focs (a.k.a. folks),

I'm wondering if it is possible to create a user defined function that takes a run-time parameter value. For this example the function takes a numeric value provided by the user and multiplies it by two. This is what I have...
FUNCTION
 -*DM_JOB_TYPE=512 
DEFINE FUNCTION MYFUNC(MYPARM/D8  XDEFAULT '1') 
MYFUNC/D8=MYPARM * 2; 
END 


SYNONYM
VARIABLE
 VARIABLE NAME=&MYPARM,  USAGE=D8, $ 


SYNONYM
DEFINE
 DEFINE MYDEFINE/D20=DF.psrdevdata/myfunc.MYFUNC(&MYPARM); $ 


If this is legitimate how do I use this in a WebFOCUS procedure? If it's not legitimate is there a way to do this?

Thanks!

Dan

This message has been edited. Last edited by: Kerry,


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
August 18, 2011, 01:20 PM
Ramkumar - Webfous
Hi Dan,

You can define a Function, to accept params, and return a variable. The name of the returned variable and the name of the function should be the same.

A detailed explanation of user defined functions can be found at WebFOCUS Functions Doug's Blog. You can see that...


Thanks,

Ramkumar.
WebFOCUS/Tableau
Webfocus 8 / 7.7.02
Unix, Windows
HTML/PDF/EXCEL/AHTML/XML/HTML5