I don't know how to call a dynamic column name in a table file. I have to run a PRINT in a TABLE FILE and one of the selected field depends on the value of one of another field.
In the result grid, instead of having the value of the dynamic field, I see the result value of the decode.
To sum up, I want to have this:
Y N Y N N
But I become this:
GEVFLAGA GEVFLAGO GEVFLAGF GEVFLAGO GEVFLAGO
Is there a syntax problem or is it impossible to use this solution?
WebFOCUS 7.6.4 running on Windows Output formats : PDF, Excel and HTML My blog
November 28, 2007, 11:06 AM
Francis Mariani
"The DECODE function assigns values based on the coded value of an input field" - it decodes string or numeric values not column values. To do what you want, simply change the DECODE to IF THEN ELSE:
DEFINE FILE MYTAB
DYNFIELD/A8 =
IF GEVGRPUNI EQ '01' THEN GEVFLAGA ELSE
IF GEVGRPUNI EQ '02' THEN GEVFLAGF ELSE
IF GEVGRPUNI EQ '03' THEN GEVFLAGO ELSE
IF GEVGRPUNI EQ '04' THEN GEVFLAGF ELSE GEVFLAGA;
END
TABLE FILE MYTAB
PRINT DYNFIELD
END
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 28, 2007, 02:52 PM
GinnyJakes
Just a couple of questions.
Is DYNFIELD a different value on each record in MYTAB or is it constant for the entire report?
If I understand you correctly, if DYNFIELD is '01', you want to 'PRINT GEVFLAGA'?
Please confirm. The answers will help us develop a solution for you.
Thanks a lot for the solution, that's exactly what I wanted to do.
For GinnyJakes:
DYNFIELD can be different for each record. I wanted to have "PRINT GEVFLAGA" or "PRINT GEVFLAGF" or "PRINT GEVFLAGL" or "PRINT GEVFLAGO" regarding the value of GEVGRPUNI.
For Admin:
this topic can be closed.This message has been edited. Last edited by: Jérény Deidda,
WebFOCUS 7.6.4 running on Windows Output formats : PDF, Excel and HTML My blog
November 29, 2007, 10:34 AM
Francis Mariani
Jérény, thank you for sharing pictures of your wonderful home
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server