Family Tree Report structure (2 Viewers)

jharding08

Member
Local time
Yesterday, 22:41
Joined
Feb 16, 2021
Messages
55
Any spacing requires a non proportional font. Try courier new to see what that looks like. Never done this in a tree view so I have no idea what it will do.
Can you share a screen shot

I used Consolas and it seemed to work fine. I could even count the character difference in node levels.

1614375088375.png
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 01:41
Joined
May 21, 2018
Messages
8,463
Are the line spaces and the "married to" lines just extra nodes? Or how is that done. I do not believe you can have two lines of text for a node.
Fyi. For your report if you want more columns you can fake this without a tree which may give you more flexibility. If you run through the data recursively you can assign a level and sort order to each node in the 'tree". So Grandfather Paternal is node sort 1 level 1. Male chid1 is Node sort 7 level 3. Assume each level is indented 5 spaces. You can write a query to indent each string (5 * level). Then the node text gets indented and you can have other columns.

I have done this with a listbox to fake a tree view and it worked well. It looked like an outline with additional columns.
 

jharding08

Member
Local time
Yesterday, 22:41
Joined
Feb 16, 2021
Messages
55
I am trying to do some runtime level debugging at the addRootNode and addBranch procedures.
What is the syntax to display the Key, ParentID, etc in the error message if I'm not physically selecting a node.

For example the error where the key is not unique. How do I show which Key it errored on in the Set currentnode=mtvw.nodes.add function?

I do three mtvw.nodes.add in a row to get the three married lines
Set currentNode = mTVW.Nodes.Add()
Set CurrentNode=mtvw.nodes.add(,,currentId & "-1", [Spouse1])
Set CurrentNode=mtvw.nodes.add(,,currentId & "-2", "MarriedTo)
Set CurrentNode=mtvw.nodes.add(,,currentId, [Spouse2])
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 01:41
Joined
May 21, 2018
Messages
8,463
Not sure of your question but you can use a variable to save the key and make it easier to print in the debug.

Maybe something

Code:
dim TheKey as string
TheKey = currentId & "-1", [Spouse1]
set CurrentNode = mtvw.nodes.add(,,TheKey)

..... Error handler
if err.number = some invalid key error number then
  debug.print Err.number & " " & err.description & " The key = " & thekey
else

end if
 

jharding08

Member
Local time
Yesterday, 22:41
Joined
Feb 16, 2021
Messages
55
Thank you for all your help. One last question (Hopefully). When displaying a tree view in a report (Read Only), how would I get it to go to a second page if the nodes extend past the height of the tree view/report height?
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 01:41
Joined
May 21, 2018
Messages
8,463
Sorry, but that is something I have never done or thought of doing. I have never had the need to do this in a report. I do not know how limited you will be with print a single control.

However this is what I was getting at about the node sort order and node level.

in that long example thread, there was code developed to take the tree and save the node sort order back to the table. If you read a tree from the top down fully expanded the sort order goes in that order. I also show how to save the node level.

With this information you can fake a tree in a report, and that may give you more flexibility.
Since you know the sort order and the level you simply sort by the sort order. (I demonstrate how to get this from the tree or you could roll your own without the tree), and indent by the level.

Code:
Public Function SpacedText(Str As String, level As Integer, Optional Spaces As Integer = 5, Optional character As String = " ") As String
  SpacedText = String(level * Spaces, character) & Str
End Function

Thien you get something like this in the report
tree.jpg


If you know how many levels you have and it is manageable, you may have even more flexibility by doing this in pure sql. You can even use sorting and grouping.

Assume you have 5 levels. Drop the table 5 times in the query designer. Filter the first one to the top node or nodes. Then just link each by parent id. Now you can do sorting and grouping by level and could format this nicer. You can label each level. This is a "hard coded" solution since you define the max levels, but the reporting format is more flexible.
 

jharding08

Member
Local time
Yesterday, 22:41
Joined
Feb 16, 2021
Messages
55
Would this be all in the detail of the report since the indentation is handled in the code? No grouping needed either?
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 01:41
Joined
May 21, 2018
Messages
8,463
Yes. What i was proposing first was just in the detail with spaces added for each level.
 

jharding08

Member
Local time
Yesterday, 22:41
Joined
Feb 16, 2021
Messages
55
I think that would work because it would extend to a second page. It would just be the nose text that shows in a text field indented using the level like you mentioned. Ill check out the code to add sort order and level.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:41
Joined
Sep 12, 2006
Messages
15,614
It's one thing navigating a tree. It's another displaying it.

A tree It's generally an upside down tree. One root (at the top), and thousands of branches at the bottom. So it's easy to consider academically but very difficult to draw, because it's wide at the bottom.

I suppose you need to eliminate branches of the tree at some level of precedence where you aren't interested. So you might need your own cousins, but from grandparents upwards maybe you only need siblings.

@The_Doc_Man has illustrated some of the practical issues. It depends whether you only want to model genetic lineage, rather than families I imagine.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 01:41
Joined
May 21, 2018
Messages
8,463
I think that would work because it would extend to a second page.
I think you could make it look just like your post in 21.

To reiterate you may have some more options if you build the queries and reports. Assume you make queries and reports for a set amount of levels. 3 generations, four generations, five generations..... done as described in #26. It gets to be a pain ITA after that.

But this allows you to alias fields and tables like TblGreatGreatGrandParent and fields can be aliased or calculated to show Great Great Grand Parent

I did one up to six manually.
Then what you could do is pick a base person. Lets say it is your Great Great Grand Father. You could calculate a tree from that person down and calculate the amount of generations below. Lets assume you have kids but no grand kids (adds another generation). This person has five generations then. You could then choose the 5 generation report with the base node being your Great Geat Grand Father.
If you pick your father as the base node then you generate the 3 generation report.

I have never done this, and it would be more work than simply indenting, but you may be able to format this much nicer. You may be able to put spouses on the same line in the group.

As said if this is more than binary genetic lineage it gets complicated for display. If pure binary lineage you could make and unbound report, but if you are showing all brothers and sisters, second wives, second husbands, etc. than unlikely you could do that.
 

jharding08

Member
Local time
Yesterday, 22:41
Joined
Feb 16, 2021
Messages
55
I think I have it in the form like I want:
1614715542700.png


Is there a way to shrink the vertical space if there isn't a spouse?

I have 'Can Shrink' for Married To and Spouse textboxes and 'Can Shrink' for Detail section, but it just shrinks a bit. I think just collapses the textboxes. The values are null
1614715587386.png


I left the borders on to make sure they disappear when null
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Today, 01:41
Joined
May 21, 2018
Messages
8,463
Not sure. Is MarriageDate and SpouseBD also set to can shrink? Are there any other controls on that line? Like a line for formatting? What happens if you shrink the controls all down to no height, then set the can grow to true?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:41
Joined
Sep 12, 2006
Messages
15,614
As an alternative to producing a report, you could open a spreadsheet and write the data to rows and columns on the spreadsheet.
That would be easier practically, wouldn't it? Use a preformatted spreadsheet with the column names you want.
You avoid all the technical issues with reports. that way, and save time.
 

Users who are viewing this thread

Top Bottom