Focal Point
Decode Function

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

August 10, 2004, 07:47 PM
<rstull>
Decode Function
I am working on a report in which the data I am reporting against contains parent/child relationships. Each child is tied to its parent through a numerical code. Each child also has its own numerical code. I am trying to achieve a report that will show sales information for all of the children of a particular parent. I have set up a decode similar to below:

COMPUTE Child/A20 = DECODE Parent (111111 'GROUPNAME1' 222222 'GROUPNAME2' 33333 'Groupname3');
AS 'Child Group'


The problem I am encountering is that each parent may have several children, so there is a separate entry for each child of a parent. Is there a way to summarize all of the children of a parent to create one entry per parent code, while totaling and displaying the sales figures for the entire group? For example

Child Group Total Sales
GroupName1 $500,000
GroupName2 $600,000
GroupName3 $10, 000

Thanks!

Rachel
August 10, 2004, 07:54 PM
Leah
Rachel,

Have you tried using a define for the child group rather than a compute? Then sum by the group.

DEFINE FILE XYZ
CHILD/A20 = DECODE.....
END
TABLE FILE XYZ
SUM SALES BY CHILD
END
August 11, 2004, 02:08 PM
GCohen
This type of report is handled in the
Developer Studio option in Report Painter called
the FML (financila modeling language) where lots
of parent/child relations occur (account parent to child accounts in GL) .
See the Documentation on how to use this feature.
August 11, 2004, 02:26 PM
<rstull>
Thank you both for the advice! I'll be working on it this morning.