Focal Point
[solved] Data in fields changing want report to stay the same.

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

June 12, 2012, 12:24 PM
Greg
[solved] Data in fields changing want report to stay the same.
I have a report that gathers data from our payroll system and they are renaming the paycodes. Ex: PER (Personal) is becoming PTO (Personal time off). But... There is always a but, they want the report to stay the same.

I piped up at the meeting right away and said it could be done in webfocus. I had seen it done before.

Now I can not find it for the life of me and I don't even now what to search for. "Replace" returns to many results, and I can not search for "AS" its to short.

Its on the tip of my tongue so to speak.

So Funeral Leave (FNL), is becoming 30 different Bereavement codes. B01, B02, B03, etc... Depending on the relation to you of the person that died.

So If my report sees and field that is EQ B* I need the report to still show FNL.

IF PAYCODE EQ 'B01 OR B02 OR B03' PRINT AS FNL <--- is this close?

I know this is easy, I just can't find an example.

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


prod: WF 7.7.03 platform IIS on Windows 2007, databases: Oracle, , MSSQL

June 12, 2012, 12:53 PM
susannah
DEFINE FILE CAR
NEWNAME/A30=DECODE COUNTRY('FRANCE' 'ROQUEFORT' 'ITALY' 'PARMIGIANA' 'JAPAN' 'SAKI' 'ENGLAND' 'STILTON' ELSE 'AMERICAN');
END
TABLE FILE CAR
SUM SALES BY NEWNAME
END
...or...
DEFINE FILE CAR
NEWNAME/A30=IF COUNTRY EQ 'ITALY' OR 'FRANCE' OR 'ENGLAND' THEN 'EUROPEAN UNION' ELSE
IF COUNTRY EQ 'GREECE' THEN 'JURY STILL OUT' ELSE 'USA');
END
you can string up to 41 IF THEN ELSE's together, as i recall, before you have to start a new one.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
June 12, 2012, 01:09 PM
Dan Satchell
More on the DECODE function... If the conversion will be used in a number of reports, you could place the DECODE elements in a flat file, or a separate FEX (and use -INCLUDE) so you have only one place to do maintenance. Depending on the number of conversion elements (DECODE has limits), you might need to create a FOCUS file indexed on the field containing the new values and JOIN to this table to pick up the legacy values.

This message has been edited. Last edited by: Dan Satchell,


WebFOCUS 7.7.05
June 12, 2012, 01:43 PM
susannah
amen to that, Dan
June 12, 2012, 01:53 PM
Greg
The report in question is a pdf compound report of 5 different reports. So DECODE in a flat file may be the way to go.


prod: WF 7.7.03 platform IIS on Windows 2007, databases: Oracle, , MSSQL

June 12, 2012, 03:15 PM
Waz
The flat file is the easiest to maintain if you don't go beyond the limits.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 12, 2012, 04:37 PM
Todd_Wallace
Building off of Susannah's example above couldn't you just use:

 
DEFINE FILE CAR
NEWNAME/A30=DECODE COUNTRY(
ITALY 'EUROPEAN UNION'  
FRANCE 'EUROPEAN UNION' 
ENGLAND 'EUROPEAN UNION' 
GREECE 'JURY STILL OUT'
ELSE USA);
END


Quotes only needed if there are spaces.
I find it easier because I don't have to have all those OR's and I can list them one line at a time so it's easy to edit. In addition, you can put a define in a Masterfile so that it applies to any reports that use that Masterfile. Of course it's not as flexible as the if statements because it's only exact matches so you couldn’t do the following:

 
NEWNAME/A30= IF COUNTRY CONTAINS 'E' OR 'Y' THEN 'EU' ELSE 'USA';


Which might make it easier on all those B* codes.


WebFOCUS 8.1.05
Windows-iSeries DB2, All Outputs
HTML