Focal Point
[SOLVED] Error in define in master file

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

August 14, 2015, 12:48 PM
Egon
[SOLVED] Error in define in master file
Hi,

I'm running into an issue where I have a define function that I'm trying to use in my master file but when I try to run a report it doesn't work.

The function on its own works. The sample data while editing the master file works.

Below is the error message:
  0 ERROR AT OR NEAR LINE      6  IN PROCEDURE ST0110_NWDWFOCEXEC *
 (FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED:
 DF.baseapp/term_desc.TERM_DESC
 (FOC101) ERROR IN DEFINE IN MASTER FILE: NW_D_ST0110
 BYPASSING TO END OF COMMAND 


And here is the code from the Define Function:

DEFINE FUNCTION TERM_DESC DESCRIPTION 'Creates the description field for the term code'(TERM/A6 DESCRIPTION 'This is the term code')
YEAR_NUMBER/D4=ATODBL(TERM,'4',YEAR_NUMBER)-1;
YEAR_TEXT_FALL/A4=EDIT(YEAR_NUMBER);
YEAR_TEXT_SPRING/A4=EDIT(TERM,'9999$$');
TERM_DESC/A20=IF TERM LIKE '____10' THEN 'Fall' || (' ' | YEAR_TEXT_FALL) ELSE IF TERM LIKE '____20' THEN 'Spring' || (' ' | YEAR_TEXT_SPRING) ELSE 'Summer' || (' ' | YEAR_TEXT_SPRING);
END
  


What may be causing this, the define function itself is an FEX file store in the baseapp folder on the Data Server.

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


WebFocus App Studio 8.1.0.5, Windows 7 64bit.
August 14, 2015, 01:21 PM
GavinL
At a quick glance, as I'm not a expert on creating functions, but the following looks incorrect..

DEFINE FUNCTION TERM_DESC DESCRIPTION 'Creates the description field for the term code'(TERM/A6 DESCRIPTION 'This is the term code')


Shouldn't it be:
DEFINE FUNCTION TERM_DESC(TERM/A6)

Also the last function I created, I tried using ATODBL and it kept telling me it wasn't a valid function. Not sure if was how I was using it or what.

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



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
August 14, 2015, 01:41 PM
MartinY
Look at this :
How To Create A Function


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
August 14, 2015, 01:46 PM
GavinL
This works for me...


DEFINE FUNCTION TERM_DESC(TERM/A6)
-* DESCRIPTION 'Creates the description field for the term code'(TERM/A6 DESCRIPTION 'This is the term code')
YEAR_NUMBER/D4=ATODBL(TERM,'4',YEAR_NUMBER)-1;
YEAR_TEXT_FALL/A4=EDIT(YEAR_NUMBER);
YEAR_TEXT_SPRING/A4=EDIT(TERM,'9999$$');
TERM_DESC/A20=IF TERM LIKE '____10' THEN 'Fall' || (' ' | YEAR_TEXT_FALL) ELSE IF TERM LIKE '____20' THEN 'Spring' || (' ' | YEAR_TEXT_SPRING) ELSE 'Summer' || (' ' | YEAR_TEXT_SPRING);
END

-RUN

DEFINE FILE GGSALES
D_DATES/A20 = DECODE SEQ_NO (1 '200510'
2 '200601'
3 '200720'
4 '200808'
5 '200911' ELSE 0);
END
TABLE FILE GGSALES
PRINT SEQ_NO
D_DATES
COMPUTE C_DATES/A20V = TERM_DESC(D_DATES);
IF SEQ_NO FROM 1 TO 5
ON TABLE SET ONLINE-FMT STANDARD
END

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



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
August 14, 2015, 02:37 PM
Egon
Thank you all. I believe there is something going on when it is trying to retrieve the user function which is in an FEX file in the baseapp folder on the data server.

If I place the function straight into my report it works. If I test the function from the synonym/master file edit it works.

As soon as I run the report it's not working. Ps. this user function is being used in other master files and reports and it works perfectly fine in those.


WebFocus App Studio 8.1.0.5, Windows 7 64bit.
August 14, 2015, 02:57 PM
Egon
Don't ask me why, but I resolved it by deleting the master file and starting over from scratch. Nothing is really different, but now it's working.


WebFocus App Studio 8.1.0.5, Windows 7 64bit.