What would be the best way to show parent-child realtion in a tree structure (not accordian report)?
I am able to pull out data and could have parent-child transformation but I am confused on how to represent this like a tree structure. Please post your suggestions.
ThanksThis message has been edited. Last edited by: Kerry,
8.1.05 HTML,PDF,EXL2K, Active, All
October 14, 2009, 04:54 PM
Waz
Have a look at the FOR statement with WITH CHILDREN option. then use BLANKINDENT to set the indenting of levels.
Your Master must have the parent and child fields defined.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
October 14, 2009, 10:27 PM
Doug
Could you elaborate on your request. I'm not sure what, exactly, you're looking to accomplish. Unless what Waz provided is correct. Either way, I'm looking forward to your next post...
October 14, 2009, 10:50 PM
Enigma006
Thanks Waz, I will try that.
Doug, I am trying to get a tree structure showing parent on the top and its children as branches and grand children etc..
My master has 2 colums, parent and child which have data in both ways. I made a report to find the parent and its children (multiple levels) and now I want to represent them in tree structure. Let me know if I am not clear yet.
Thanks
8.1.05 HTML,PDF,EXL2K, Active, All
October 15, 2009, 07:13 AM
<JG>
It's all in the master you need to code the PROPERTY=PARENT_OF attribute into the master
SET BLANKINDENT=ON TABLE FILE DUMMY PRINT PARENT NOPRINT FOR CHILD 1000 WITH CHILDREN ALL END
October 15, 2009, 10:10 AM
Enigma006
Hey JG,
I cant make changes in the master file. And also some children exist in parent column too having children..So I wrote recursive joins to get the parents and children.
8.1.05 HTML,PDF,EXL2K, Active, All
October 15, 2009, 10:35 AM
<JG>
The example here has children as parents.
Create a hold file from your source data. dynamically -WRITE or whatever method you prefer to rewite the hold master and you have everything you need.
Run the sample code and you'll see what I mean.
October 15, 2009, 12:35 PM
Enigma006
Sure JG. I will give a try and will post my results in a day or two..Thanks for all your suggestions..
8.1.05 HTML,PDF,EXL2K, Active, All
October 16, 2009, 11:41 AM
Enigma006
Hey JG,
I could not write a dummy master as there is huge data. And the hold fine I create that comes of my report has a parent field and multiple child fieds in levels..
It is like...
Joins on original master
TABLE FILE T1 PRINT LEVEL4_CHILD BY PARENT BY LEVEL1_CHILD BY LEVEL2_CHILD BY LEVEL3_CHILD ON TABLE HOLD AS T2 END Is there any way to get the tree structure?
Thanks
8.1.05 HTML,PDF,EXL2K, Active, All
October 18, 2009, 04:35 PM
Waz
DEFINE FILE T1
DUMMY/A10 = ' ' ;
END
TABLE FILE T1
BY DUMMY
BY PARENT
ON TABLE SAVE AS T2
END
FILEDEF T2 DISK t2.ftm (APPEND
TABLE FILE T1
BY PARENT
BY LEVEL1_CHILD
ON TABLE SAVE AS T2
END
TABLE FILE T1
BY LEVEL1_CHILD
BY LEVEL2_CHILD
ON TABLE SAVE AS T2
END
TABLE FILE T1
BY LEVEL2_CHILD
BY LEVEL3_CHILD
ON TABLE SAVE AS T2
END
TABLE FILE T1
BY LEVEL3_CHILD
BY LEVEL4_CHILD
ON TABLE SAVE AS T2
END
FILEDEF T2 DISK t2.ftm
EX -LINES 5 EDAPUT MASTER,t2,CV,FILE
FILENAME=T2, SUFFIX=FIX,$
SEGNAME=T2, $
FIELD=PARENT,ALIAS= ,A10 ,A10 ,PROPERTY=PARENT_OF,REFERENCE=CHILD, $
FIELD=CHILD,ALIAS= ,A10 ,A10 ,$
-RUN
SET BLANKINDENT=ON
TABLE FILE T2
PRINT PARENT NOPRINT
FOR CHILD
{Start point} WITH CHILDREN ALL
END