Focal Point
Modifying column data and using in BY-Issue

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

March 27, 2007, 05:46 AM
Prasanna
Modifying column data and using in BY-Issue
All,
I have to rename the data of the Column in the Output and I'm using this column in the grouping condition(BY).I tried using IF Condition in DEFINE but its not giving me the expected output.For eg: if i have a COLUMN1 with data as AB,BC,CD,EF.And i want show AB,BC as ABC and CD,EF as CDEF.So, in the output i will be having ABC and CDEF with the data of AB,BC grouped iin ABC and CD,EF grouped in CDEF.
When i tried the same with COMPUTE,it is not giving me the right answer.
Let me know if you have a solution.
Regards
R.Prasanna


Dev:
Dev Studio 7.1.6,Report Caster 7.1.1,Servlet
Local:
Dev Studio 7.1.6,Report Caster 7.1.1,Apache 5.0.2,
Win XP


March 27, 2007, 06:24 AM
Danny-SRL
Prasanna,
Be clear:
If you have in your TABLE command BY COL1 and a result where:
COL1
AB
BC
CD
EF

you would like to see 2 rows instead of 4. That is ok. BUT, if in the first 2 original rows, by chance, you have AB and BC then in the resulting 1 row you want to see ABC? Then what is B?

However, if you want to show in each resulting row the concatenation of the values of COL1 for each 2 original rows, then try this:
TABLE FILE CAR
SUM SALES 
COMPUTE CC/I1=IF LAST CC EQ 0 THEN 1 ELSE 0;
COMPUTE LL/I5=IF CC EQ 1 THEN LAST LL + 1 ELSE LAST LL;
BY CAR
ON TABLE HOLD
END
-RUN
SET ASNAMES=ON
TABLE FILE HOLD
SUM CAR SALES BY LL
ACROSS HIGHEST CC
ON TABLE HOLD AS HOLD1
END
DEFINE FILE HOLD1
CAR2/A38=CAR1 || ' ' | CAR0;
SAL2/I6=SAL1 + SAL0;
END
TABLE FILE HOLD1
PRINT CAR2 SAL2
END

This message has been edited. Last edited by: Danny-SRL,


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

March 27, 2007, 07:23 AM
Tony A
Prasanna,

Add a define (as you probably aready have) that DECODEs the value from column1 -
DEFINE FILE filename
NEW_COL/A4 = DECODE column1 ('AB' 'ABC' 'BC' 'ABC' 'CD' 'CDEF' 'EF' 'CDEF' ELSE '?')
and then sort on NEW_COL.

This would be covered in a basic training course and you should push your managers to provide you with training.

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