Focal Point
[CLOSED] Problem printing Decimal and Text Under Same Column Name

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

May 25, 2015, 04:35 AM
iBeny
[CLOSED] Problem printing Decimal and Text Under Same Column Name
Hi

I have Rate(%) Column and Date Column in a report and there is a Scenario where these come out to be null.
The user requires me to print keyword 'Pending' instead of a Blank cell value Where Rate(%)/Date is null.
I am not able to handle it using IF in a Define.
I want something like:

-*RATE/D20.2= IF RATE IS MISSING THEN 'PENDING' ELSE RATE ;
-*RATE/A20 = IF RATE IS MISSING THEN 'PENDING' ELSE RATE;


this leads to a Data Type Mismatch, the first line of code cannot store 'Pending', the second line cannot store RATE as it is D20.2.

In the end report i need to show

RATE
0.8
0.9
Pending
Pending

Please Help Guys!

This message has been edited. Last edited by: <Kathryn Henning>,


Webfocus 8105,8808,7703,7611, EXL2K,HTML,PDF,COMT,AHTML Info Assist+ , Reportcaster
May 25, 2015, 05:48 AM
Alan B
Use FPRINT to convert the RATE field to A20. There are plenty of examples on the Forum.


Alan.
WF 7.705/8.007
May 26, 2015, 06:58 AM
eric.woerle
You could also use SET NODATA="Pending" . This will set all null values to whatever value you specify.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
May 27, 2015, 06:41 AM
iBeny
I implemented SET NODATA = 'Pending'.
I'll also check the FPRINT if it does not remove the Leading 0 from the Decimal.


Webfocus 8105,8808,7703,7611, EXL2K,HTML,PDF,COMT,AHTML Info Assist+ , Reportcaster
May 27, 2015, 07:37 AM
MartinY
Post your code...


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
May 27, 2015, 10:42 AM
Wep5622
You can also use dynamic formatting, search the forum for details.

It boils down to something like this:
DEFINE FILE FOO
  RATEFMT/A8 = IF RATE IS MISSING THEN 'A20' ELSE 'D12.2';
END
TABLE FILE FOO
PRINT COMPUTE RATEX/RATEFMT = IF RATE IS MISSING THEN 'Pending' ELSE RATE;
END


It's a bit tricky to get to work. For example, the format-field HAS to be of type A8, no smaller or larger, or it won't work.

FPRINT is definitely easier to get to work. Often I accompany it with a flag-field for conditional styling - text is left-justified, numbers right-justified. Does the trick.

The only issue with FPRINT is if you export the data to a format where calculations are done on the result, but I sure hope nobody plans to do so if some of the values can contain 'Pending'!


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :