Focal Point
[SOLVED] I got an error through Report painter doing a DECODE

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

January 26, 2010, 11:51 AM
Marikaki
[SOLVED] I got an error through Report painter doing a DECODE
Hi,

Doing my first baby steps in Webfocus I got this error:

-IF PROFITCENT NE LAST PROFITCENT THEN ABC =
0 ERROR AT OR NEAR LINE 112 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC261) EXPRESSION IS INCOMPLETE BECAUSE AN OPERATION IS MISSING

Please see the partial following code of my report:

-IF PROFITCENT NE LAST PROFITCENT THEN &APCDESC =
DECODE PROFITCENT ( 001 'MTL' 401 'QUE' 150 'BOO' 200 'DES' 300 'ALM' 500 'HUO' 100 'BAR' 600 'MUE' ELSE 'XYZ') ELSE FOC_NONE;

Your help will be appreciated. Thanks

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


Marikaki

WF 7.7.03m, MRE, BI Dashboard, DevStudio, Report Caster, Windows 7, I.E. 8/9, Apache Tomcat 6.0, Derby Output formats: Excel2K, PDF, HTML, AHTML

January 26, 2010, 12:10 PM
njsden
Hi Marikaki,

You seem to be mixing FOCUS code (use of LAST keyword pertaining to record manipulation) with Dialog Manager-specific syntax which are not really mixable the way you're trying to do.

Could you describe exactly what you're attempting to do to see if any of us can shed some light?

I would suggest however that you take a deep review on product documentation to strengthen your foundations on the tool (Creating Reports with WebFOCUS Language comes to my mind).



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
January 26, 2010, 12:15 PM
TexasStingray
Please post a little more code. to give every one a better understnading




Scott

To further explain, anything that starts with a dash is considered Dialogue Manager and you should be testing against amper variables, not real fields and njsden is correct in that LAST won't work there.

If your IF test is in a DEFINE or COMPUTE, then it must be on the right-hand side of an equal sign, i.e.
FIELDNAME/format=IF ...;  


Does this make sense?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
quote:
Originally posted by TexasStingray:
Please post a little more code. to give every one a better understnading


I would like my report to print a short description instead of the long one of the profit center column on each breakdown .
------------------------------------------
-DEFAULTS &APCDESC = 'ABC';
....

TABLE FILE T3Y_SLSWKBGT
-IF PROFITCENT NE LAST PROFITCENT THEN &APCDESC = DECODE PROFITCENT ( 001 'MTL' 401 'QUE' 150 'BOO' 200 'DES' 300 'ALM' 500 'HUO' 100 'BAR' 600 'MUE') ELSE FOC_NONE;
SUM
CURSALES/P12C AS 'RÉEL(R),ACTUEL'
COMPUTE CPSLSCUM/D12 = IF PRFCENTDSC EQ LAST PRFCENTDSC THEN CPSLSCUM + CURSALES ELSE CURSALES; AS '***.'

.....
-*BY PRFCENTDSC AS 'Centre,Profit'
BY &APCDESC AS 'Ctr,Pft'
BY PERIODWK AS 'Sem.'
BY NBRWDYWK AS '#Jrs'
HEADING
"&TITLE_1"
....


I can provide more, just tell me.


Marikaki

WF 7.7.03m, MRE, BI Dashboard, DevStudio, Report Caster, Windows 7, I.E. 8/9, Apache Tomcat 6.0, Derby Output formats: Excel2K, PDF, HTML, AHTML

Is 'ABC' a column name in T3Y_SLSWKBGT? I'm asking this because you have a BY phrase which will evaluate to 'BY ABC AS ...".

Is PROFITCENT a column name as well?

If I could take a guess, I'd say that it needs to look like this:
DEFINE FILE T3Y_SLSWKBGT
APCDESC/A3=DECODE PROFITCENT ( 001 'MTL' 401 'QUE' 150 'BOO' 200 'DES' 300 'ALM' 500 'HUO' 100 'BAR' 600 'MUE') ELSE ' ';
END
TABLE FILE T3Y_SLSWKBGT
SUM
CURSALES/P12C AS 'RÉEL(R),ACTUEL'
COMPUTE CPSLSCUM/D12 = IF PRFCENTDSC EQ LAST PRFCENTDSC THEN CPSLSCUM + CURSALES ELSE CURSALES; AS '***.'

.....
-*BY PRFCENTDSC AS 'Centre,Profit'
BY APCDESC AS 'Ctr,Pft'
BY PERIODWK AS 'Sem.'
BY NBRWDYWK AS '#Jrs'
HEADING
"&TITLE_1"
....


How does that look to you? Does it make sense?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
You got it right Ginny. Thanks alot. It works. That will enthusiamed me to continue using forums. This can be considered as closed.

quote:
Originally posted by GinnyJakes:
Is 'ABC' a column name in T3Y_SLSWKBGT? I'm asking this because you have a BY phrase which will evaluate to 'BY ABC AS ...".

Is PROFITCENT a column name as well?

If I could take a guess, I'd say that it needs to look like this:
DEFINE FILE T3Y_SLSWKBGT
APCDESC/A3=DECODE PROFITCENT ( 001 'MTL' 401 'QUE' 150 'BOO' 200 'DES' 300 'ALM' 500 'HUO' 100 'BAR' 600 'MUE') ELSE ' ';
END
TABLE FILE T3Y_SLSWKBGT
SUM
CURSALES/P12C AS 'RÉEL(R),ACTUEL'
COMPUTE CPSLSCUM/D12 = IF PRFCENTDSC EQ LAST PRFCENTDSC THEN CPSLSCUM + CURSALES ELSE CURSALES; AS '***.'

.....
-*BY PRFCENTDSC AS 'Centre,Profit'
BY APCDESC AS 'Ctr,Pft'
BY PERIODWK AS 'Sem.'
BY NBRWDYWK AS '#Jrs'
HEADING
"&TITLE_1"
....


How does that look to you? Does it make sense?



Marikaki

WF 7.7.03m, MRE, BI Dashboard, DevStudio, Report Caster, Windows 7, I.E. 8/9, Apache Tomcat 6.0, Derby Output formats: Excel2K, PDF, HTML, AHTML