Focal Point
Help with another Define

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

February 20, 2008, 11:20 AM
Rob M.
Help with another Define
When I try to do the following define I get the following error message:

(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: NUM
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: NUM


What is wrong? Why is it cutting off ACCOUNT in the ACCOUNTNUM?



DEFINE FILE T_PROD_PO
DATETODAY/HYYMDS=HGETC(10, DATETODAY);
POAGE/D5=HDIFF(DATETODAY, ORDERDATE, 'DAY', POAGE);
GROUPNAME/A30=
IF T_PROD_POLINE.ACCOUNTNUM EQ '693001' OR T_PROD_POLINE.ACCOUNTNUM EQ '693016' OR T_PROD_POLINE.ACCOUNTNUM EQ '693010' THEN 'HOUSEKEEPING'
ELSE
IF T_PROD_POLINE.ACCOUNTNUM EQ '693006' OR T_PROD_POLINE.ACCOUNTNUM EQ '650151' OR T_PROD_POLINE.ACCOUNTNUM EQ '693007' OR T_PROD_POLINE.ACCOUNTNUM EQ '693005' OR T_PROD_POLINE.ACCOUNTNUM EQ '693020' OR T_PROD_POLINE.ACCOUNTNUM EQ '657009' THEN 'EXTERIOR/HORIZONTAL SURFACES'
ELSE
IF T_PROD_POLINE.ACCOUNTNUM EQ '650127' OR T_PROD_POLINE.ACCOUNTNUM EQ '657020' OR T_PROD_POLINE.ACCOUNTNUM EQ '637000' THEN 'GM/VTRAN'
ELSE
IF T_PROD_POLINE.ACCOUNTNUM EQ '650124' OR T_PROD_POLINE.ACCOUNTNUM EQ '657030' OR T_PROD_POLINE.ACCOUNTNUM EQ '657007' OR T_PROD_POLINE.ACCOUNTNUM EQ '650132' THEN 'INTERIOR & EXTERIOR FINISHES'
ELSE
IF T_PROD_POLINE.ACCOUNTNUM EQ '693040' OR T_PROD_POLINE.ACCOUNTNUM EQ '657010' OR T_PROD_POLINE.ACCOUNTNUM EQ '693017' OR T_PROD_POLINE.ACCOUNTNUM EQ '693002' OR ACCOUNT NUM EQ '650160' OR T_PROD_POLINE.ACCOUNTNUM EQ '693009' THEN 'WATER/WASTE/PEST'
ELSE
IF T_PROD_POLINE.ACCOUNTNUM EQ '693008' THEN 'DIRECT SALES/PRODUCTION'
ELSE
IF T_PROD_POLINE.ACCOUNTNUM EQ '650126' THEN 'HVAC'
ELSE
IF T_PROD_POLINE.ACCOUNTNUM EQ '651000' THEN 'REFRIGERATION'
ELSE
IF T_PROD_POLINE.ACCOUNTNUM EQ '678100' OR T_PROD_POLINE.ACCOUNTNUM EQ '651100' OR T_PROD_POLINE.ACCOUNTNUM EQ '651200' OR T_PROD_POLINE.ACCOUNTNUM EQ '693004' THEN 'SECURITY & PROTECTION'
ELSE
IF T_PROD_POLINE.ACCOUNTNUM EQ '657006' OR T_PROD_POLINE.ACCOUNTNUM EQ '657008' OR T_PROD_POLINE.ACCOUNTNUM EQ '657011' THEN 'ELECTRICAL & LIGHTING';
END


Rob M.
Target Corporation

WF 7.1.4
February 20, 2008, 11:36 AM
Leah
quote:
T_PROD_POLINE.ACCOUNTNUM EQ '693017' OR T_PROD_POLINE.ACCOUNTNUM EQ '693002' OR ACCOUNT NUM EQ


There appears to be a space between ACCOUNT and NUM in the line above.


Leah
February 20, 2008, 11:44 AM
Rob M.
quote:
Originally posted by Leah:
quote:
T_PROD_POLINE.ACCOUNTNUM EQ '693017' OR T_PROD_POLINE.ACCOUNTNUM EQ '693002' OR ACCOUNT NUM EQ


There appears to be a space between ACCOUNT and NUM in the line above.


Thanks, I scanned it quickly a few times and didn't even see that.


Rob M.
Target Corporation

WF 7.1.4
February 20, 2008, 11:51 AM
Tony A
Rob,

One thing that I would recommend to you is to make your code "neat" so that when you have errors such as these you can hone in on them quickly and efficiently.
If your coding methology is such that it becomes easy to read then your debugging will generally be easier as well.

Also think of ways that you can save yourself from repetative coding such as using INCLUDE files or, in the case above, using IN instead of multiple ORs -
GROUPNAME/A30 = IF T_PROD_POLINE.ACCOUNTNUM IN ('693001','693016','693010')                            THEN 'HOUSEKEEPING'
           ELSE IF T_PROD_POLINE.ACCOUNTNUM IN ('693006','650151','693007','693005','693020','657009') THEN 'EXTERIOR/HORIZONTAL SURFACES'
           ELSE IF T_PROD_POLINE.ACCOUNTNUM IN ('650127','657020','637000')                            THEN 'GM/VTRAN'
           ELSE IF T_PROD_POLINE.ACCOUNTNUM IN ('650124','657030','657007','650132')                   THEN 'INTERIOR & EXTERIOR FINISHES'
           ELSE IF T_PROD_POLINE.ACCOUNTNUM IN ('693040','657010','693017','693002','650160','693009') THEN 'WATER/WASTE/PEST'
           ELSE IF T_PROD_POLINE.ACCOUNTNUM IN ('693008')                                              THEN 'DIRECT SALES/PRODUCTION'
           ELSE IF T_PROD_POLINE.ACCOUNTNUM IN ('650126')                                              THEN 'HVAC'
           ELSE IF T_PROD_POLINE.ACCOUNTNUM IN ('651000')                                              THEN 'REFRIGERATION'
           ELSE IF T_PROD_POLINE.ACCOUNTNUM IN ('678100','651100','651200','693004')                   THEN 'SECURITY & PROTECTION'
           ELSE IF T_PROD_POLINE.ACCOUNTNUM IN ('657006','657008','657011')                            THEN 'ELECTRICAL & LIGHTING';

As for the error, I think Leah hit it right on the head!!

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
February 21, 2008, 09:44 AM
ira
Leah is right on the mark. Tony's suggestion to clean it up makes it much easier to debug things when they are aligned. An alternate possibility is using decode (keeping in mind its limitations.

DEFINE FILE T_PROD_PO
DATETODAY/HYYMDS=HGETC(10, DATETODAY);
POAGE/D5=HDIFF(DATETODAY, ORDERDATE, 'DAY', POAGE);
GROUPNAME/A30= DECODE T_PROD_POLINE.ACCOUNTNUM
('693001' 'HOUSEKEEPING'
'693016' 'HOUSEKEEPING'
'693010' 'HOUSEKEEPING'
'693006' 'EXTERIOR/HORIZONTAL SERVICES'
'650151' 'EXTERIOR/HORIZONTAL SERVICES'
'693007' 'EXTERIOR/HORIZONTAL SERVICES'
'693005' 'EXTERIOR/HORIZONTAL SERVICES'
'693020' 'EXTERIOR/HORIZONTAL SERVICES'
'657009' 'EXTERIOR/HORIZONTAL SERVICES'
'650127' 'GM/VTRAN'
'657020' 'GM/VTRAN'
'637000' 'GM/VTRAN'
'650124' 'INTERIOR & EXTERIOR FINISHES'
'657030' 'INTERIOR & EXTERIOR FINISHES'
'657007' 'INTERIOR & EXTERIOR FINISHES'
'650132' 'INTERIOR & EXTERIOR FINISHES'
'693040' 'WATER/WASTE/PEST'
'657010' 'WATER/WASTE/PEST'
'693017' 'WATER/WASTE/PEST'
'693002' 'WATER/WASTE/PEST'
'650160' 'WATER/WASTE/PEST'
'693009' 'WATER/WASTE/PEST'
'693008' 'DIRECT SALES/PRODUCTION'
'650126' 'HVAC'
'651000' 'REFRIGERATION'
'678100' 'SECURITY & PROTECTION'
'651100' 'SECURITY & PROTECTION'
'651200' 'SECURITY & PROTECTION'
'693004' 'SECURITY & PROTECTION'
'657006' 'ELECTRICAL & LIGHTING'
'657008' 'ELECTRICAL & LIGHTING'
'657011' 'ELECTRICAL & LIGHTING');

Ira
wf 538 aix 533


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0
February 21, 2008, 10:20 AM
FrankDutch
I support the use of DECODE, or even better put this codes and translations into an external file and use that file to "decode"

(there are so many ways to do this.....)




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

February 25, 2008, 11:41 AM
ira
Frank, agreed. Because the limitation in external files is something like (or used to be) 32,000 bytes - whereas and pairs of decodes greater than 32 require an 'else' pointing back to the first decode etc.
Ira
aix 533 wf 538


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0