Focal Point
[CLOSED]Data Migrator - user defined function null/blank input and missing output

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

July 07, 2016, 06:17 PM
elizabeth@emc
[CLOSED]Data Migrator - user defined function null/blank input and missing output
I created a function with 5 parameters. Within the expression editor, the Parm values all show 'No' under the Nulls column. I don't see where I can change that.
Parm1 A2 Nulls = No
Parm2 A2 Nulls = No
Parm3 A2 Nulls = No
Parm4 A1 Nulls = No
Parm5 A6 Nulls = No

The resulting value is a description defined as A30V
The function properties box shows the "Allow Missing Data" box checked.
Within the expression editor, the Missing option says "On All"
The expression validates with the "Check Expression" button.

Expression:
IF (Parm1 EQ 'xx' AND Parm2 EQ '01') THEN 'Desc1'
ELSE
IF ((Parm1 EQ 'yy' OR 'zz') AND Parm3 EQ '01' AND Parm4 EQ '1' AND Parm5 NE ' ' ) THEN 'Desc2'
ELSE
IF (Parm1 EQ 'yy' AND Parm3 EQ '02') THEN 'Desc3'
ELSE
MISSING

Question 1:
I want the function to be able to return MISSING (NULL). When I test parm that should return MISSING (NULL), I get two errors:
FOC171 Type of missing calculation is not specified on left side: ELSE
FOC101 Error in define in masterfile: Funfile

If I change ELSE MISSING to ELSE ' ' (space), it works. If I change it ELSE '' (no space), it also works. I believe '' (no space) is the equivalent of NULL. However, why does the expression validate MISSING, but fail during testing?

Question 2:
Since the function checks for spaces in Parm5, I need Parm5 to allow spaces as an input value. When using the Test Function, I cannot leave Parm5 empty, nor can I enter six spaces. Both empty and spaces causes error:
FOC295 A value is missing for &Parm5.

I would like all parm values to be allowed to be empty (MISSING/NULL) or spaces. Is that possible?

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8.1M
Windows, All Outputs
July 08, 2016, 07:53 AM
MartinY
Hi Elizabeth,

To answer your first question and make MISSING as valid returned value, must do something like this:
DEFINE FILE ABC
RESULT /A30 MISSING ON = IF (Parm1 EQ 'xx' AND Parm2 EQ '01') THEN 'Desc1' 
ELSE 
IF ((Parm1 EQ 'yy' OR 'zz') AND Parm3 EQ '01' AND Parm4 EQ '1' AND Parm5 NE ' ' ) THEN 'Desc2' 
ELSE 
IF (Parm1 EQ 'yy' AND Parm3 EQ '02') THEN 'Desc3' 
ELSE 
MISSING;
END


You also should include your whole function's code here, it may help us. Us the "include code" tag to have the code properly included and displayed (far right button).

As for Q2, it seems that Parm5 is not passed to the function.

Add
-? &
-EXIT

as the first two lines in your function and call the function, you will then see if Parm5 is passed and with which value.

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


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007