Choose Language Hide Translation Bar
Highlighted
dProbela
Level II

Change All Items in Diagram to "Hierarchy"

Hi! 

 

I suspect there is a simple solution to this problem I'm having, but I haven't been able to figure it out. Any help is greatly appreciated. Here's what's up:

 

I'm using the Diagram platform to make a Family tree of Parent and Child data in a data table. See attached sample data set. Below, I wrote a simple script to generate the diagram. Note, this platform is typically used to make "fishbone" diagrams, but you can change the type of the diagram to "Hierarchy"  to make a tree -- which is exactly what I want! The attached code below will work perfectly for datasets where there is only one tree.

 

However--and this is my problem--sometimes I have datasets with multiple trees. The attached dataset is one such example. When I run the same code, I get a diagram where only one tree is changed to "Hierarchy" and while the other two are in "Fishbone" style--see the attached picture. 

 

How do I adjust this code so that all trees are "Hierarchy"? 

Thanks in advance!  

 

 

testDiagram = Diagram( Y( :Parent ), X( :Child ),
		
	SendToReport(
		Dispatch(
			{},
			"Cause and Effect Diagram",
			OutlineBox,
			{Set Title( "Family tree" )},
		);	
	);
		
);

testDiagram << Change Type( "Hierarchy" );
	
 

Image.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Craige_Hales
Staff (Retired)

Re: Change All Items in Diagram to "Hierarchy"

this might not be the best xpath, but it seems to work:

(report(testdiagram) << xpath( "//BorderBox/HierBox" )) << Change Type( "Hierarchy" );

I used report(testdiagram)<<showtreestructure to see the shape of the report:

Shows the HierBox are each under a BorderBoxShows the HierBox are each under a BorderBox

 

Capture2.PNG

Craige

View solution in original post

2 REPLIES 2
Highlighted
Craige_Hales
Staff (Retired)

Re: Change All Items in Diagram to "Hierarchy"

this might not be the best xpath, but it seems to work:

(report(testdiagram) << xpath( "//BorderBox/HierBox" )) << Change Type( "Hierarchy" );

I used report(testdiagram)<<showtreestructure to see the shape of the report:

Shows the HierBox are each under a BorderBoxShows the HierBox are each under a BorderBox

 

Capture2.PNG

Craige

View solution in original post

Highlighted
dProbela
Level II

Re: Change All Items in Diagram to "Hierarchy"

Hi Craig, 

 

That one line of code works , thanks so much for the help. \

Article Labels