* Conditional expressions for diagram icons

Questions regarding use of any Version of Family Historian. Please ensure you have set your Version of Family Historian in your Profile. If your question fits in one of these subject-specific sub-forums, please ask it there.
Post Reply
avatar
Peter Collier
Famous
Posts: 191
Joined: 04 Nov 2015 17:32
Family Historian: V7
Location: Worcestershire, UK

Conditional expressions for diagram icons

Post by Peter Collier » 23 Dec 2021 17:08

I have red, green, and black spot icons that display underneath the boxes on my diagrams to show if I have a B, M, or D certificate/parish record for the individual concerned. It helps give me a good at-a-glance overview of where I need to do a little more research. These icons are triggered by various conditional expressions I have set for the boxes in the diagram options.
Screenshot.png
Screenshot.png (23.54 KiB) Viewed 1477 times
For marriages, the spots include a number so I can see which of the marriages I have a record for and thus which marriage records are missing. The expressions I use for this are =ContainsText(%INDI.FAMS>MARR.SOUR>ABBR%,"M. Rec."STD), =ContainsText(%INDI.FAMS[2]>MARR.SOUR>ABBR%,"M. Reg.",STD), etc.

99% of the time it works as I would want but very occasionally, as demonstated by the screenshot above, I get a glitch. Here, Frances had a child by an uknown individual while still single before later marrying William, her first husband, and having children with him. I have the marriage record for Frances and William, so both display a green spot. William's spot is correctly numbered 1 but, beacuse my expresson uses an individual's family records and there has to be an earlier family record for Frances (with no spuose) to attach her child, Frances's spot for her marriage to William incorrectly shows the number 2.

Perhaps this is as good as it can get, but can anyone suggest a way I could improve the expression I use, or suggest a different expression altogether, that would eliminate this snag without introducing new ones? The "marriage count" icon displayed would need to include couples who might well have been married but for whom there is no marriage event in the database as I have not yet found a record, but at the same time exclude a family record from the count if (like here) there was no spouse, or there was spouse but the marriage status was "never married" or "unmarried couple" (i.e. I can be sure there never was a marriage event to be counted, not that I just haven't found it yet).
Peter Collier

Collier, Savory, Buckerfield, Edmonds, Low, Dungey, Lester, Chambers, Walshe, Moylan, Bradley, Connors, Udale, Wilson, Benfield, Downey

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Conditional expressions for diagram icons

Post by tatewise » 23 Dec 2021 18:15

Peter, I'm not quite clear on how you apply those Expressions.
I know you are using them in the Diagram > Options > Boxes tab Conditions but not sure of the details.

Firstly, there's seems to be a comma missing from the 1st Expression:
=ContainsText(%INDI.FAMS>MARR.SOUR>ABBR%,"M. Rec.",STD)

Then the two Expressions are testing different Source short title (ABBR) text, so is that a typo:
"M. Rec." and "M. Reg."

If both the 1st partnership and the 2nd partnership has a Marriage event with a matching Source short title then I would expect both Expressions to be true and so two green icons one with a 1 and one with a 2 will be displayed.

Can you please explain how only one green icon is displayed when there are multiple Marriages with Citations.
[EDIT: Maybe that is exactly what happens. You get multiple spot icons ~ one for each Marriage Citation.]
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Conditional expressions for diagram icons

Post by tatewise » 23 Dec 2021 19:38

Thinking about it a bit more, I guess "M. Rec." and "M. Reg." cater for a Marriage Index/Certificate versus a Marriage Parish Register source. You could halve the Expression Conditions by using just "M. Re". If that is not reliable enough, then perform a Search and Replace to convert them to "Marr. Rec." and "Marr. Reg.", then use "Marr. Re" in the Condition Expressions.

Getting back to the original problem, here is one solution. If you enter a Status such as "Unmarried Couple", "Never Married" or "Unknown" then the double lines between the partners are dotted.
(In your screenshot, you appear not to have set any such Status yet, because the double lines are solid.)
Then you know those partners will never have a Marriage event and the missing numbered green spot can be disregarded.

To get the number on the green spot to take account of such Status settings is not easy.
As an example, let us just consider the possibility of the 1st partnership having a Status value.
You would need more complex Condition Expressions for each partnership such as.
=IsTrue(ContainsText(%INDI.FAMS[1]>MARR.SOUR>ABBR%,"Marr. Re",STD) and Not(Exists(%INDI.FAMS>_STAT%))) Spot 1
=IsTrue(ContainsText(%INDI.FAMS[2]>MARR.SOUR>ABBR%,"Marr. Re",STD) and Exists(%INDI.FAMS>_STAT%)) Spot 1
=IsTrue(ContainsText(%INDI.FAMS[2]>MARR.SOUR>ABBR%,"Marr. Re",STD) and Not(Exists(%INDI.FAMS>_STAT%))) Spot 2
=IsTrue(ContainsText(%INDI.FAMS[3]>MARR.SOUR>ABBR%,"Marr. Re",STD) and Exists(%INDI.FAMS>_STAT%)) Spot 2
=IsTrue(ContainsText(%INDI.FAMS[3]>MARR.SOUR>ABBR%,"Marr. Re",STD) and Not(Exists(%INDI.FAMS>_STAT%))) Spot 3
and so on...
Those are not differentiating between any of the Status values including "Divorced" and "Separated".
To test for specific Status values would get even more complex.

But if the 2nd or 3rd partnership might also have a Status value, then that is a whole new ballgame involving tests for Exists(%INDI.FAMS[2]>_STAT%) and Exists(%INDI.FAMS[3]>_STAT%) in all combinations.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Peter Collier
Famous
Posts: 191
Joined: 04 Nov 2015 17:32
Family Historian: V7
Location: Worcestershire, UK

Re: Conditional expressions for diagram icons

Post by Peter Collier » 23 Dec 2021 19:45

With regard to the missing comma, I think that's just me being sloppy when I was editing my original post before submitting it. I had moved some text around a few times and must have lost the comma during the dicing and splicing without noticing.

Sorry too about the confusion regard to the short titles with Reg and Rec. I do actually use both, depending on whether the evidence has come from the GRO's register or a parish record, but it would have been a little clearer if the two examples I had picked were the same! I currently have 10 conditional expressions for marriages in total. Five of them check the first to fifth family records for a short title containing "M. Reg" and five check the same for "M. Rec". Depending on whether it is a civil ("Reg") or a parish record ("Rec"), the icon appended is a solid-coloured spot or a coloured ring.

You are correct about multiple green icons being displayed where appplicable. The parents of the man in my OP can serve as an example here:
Screenshot2.png
Screenshot2.png (14.14 KiB) Viewed 1442 times
This was grabbed fron an ancestor diagram so you are not seeing the other spouses, but the icons in this example are displaying correctly. William's parents, John and Mary, had both been widowed previously and their marriage to each other was a second marriage for both of them. I can see from the icons that I have a GRO certificate for John & Mary's marriage (the solid green spot, numbered 2) and that I have a parish marriage record for Mary's first marriage (the green ring, numbered 1). I have not yet been able to track down a record for John's first marriage so the relevant icon in that case is absent. The absence of a spot/ring numbered "1" for John alerts me to the fact that I still have a missing marriage record to search for.

The numbers in the spots/rings relate only to the individual to which they are attached, not to the couple. Couples don't always have the same tally of marriages each of course, it just happens that in this case John and Mary's marriage to each other was a second marriage for both of them and so the numbers in the spots for their marriage happen to match. If John had been a bachelor when he married the widowed Mary, then his spot would show "1" while Mary's would show "2". This is fine, and I can see no practical way to accomodate it even if it weren't.

However, and this brings me back to my original post, the icon displayed can be an issue when the number of marriages are miscounted. When William married his wife, Frances, it was a first marriage for both of them but Frances's icon for that marriage is showing a "2" for the reasons I outlined in the OP. In this case, the family is in my direct line and fairly recent so I know the facts and can just overlook it, but in the less-familar reaches of my tree it would wrongly suggest I am missing a record.
Peter Collier

Collier, Savory, Buckerfield, Edmonds, Low, Dungey, Lester, Chambers, Walshe, Moylan, Bradley, Connors, Udale, Wilson, Benfield, Downey

avatar
Peter Collier
Famous
Posts: 191
Joined: 04 Nov 2015 17:32
Family Historian: V7
Location: Worcestershire, UK

Re: Conditional expressions for diagram icons

Post by Peter Collier » 23 Dec 2021 19:48

Our second posts crossed in the mail...
Peter Collier

Collier, Savory, Buckerfield, Edmonds, Low, Dungey, Lester, Chambers, Walshe, Moylan, Bradley, Connors, Udale, Wilson, Benfield, Downey

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Conditional expressions for diagram icons

Post by tatewise » 23 Dec 2021 20:28

I will let you digest my 19:38 posting, but here are some more thoughts.

Since you are relying on 'missing' spots, how will you know when the last of multiple Marriages are missing?
If somebody was married say 4 times (not that unusual) and you have spot 1 and spot 2 how would you know to look for the 3rd and 4th Marriages?

It would be SOOOOO much easier if the spots indicated missing Marriage Citations as well as completed ones.
Then it is easier for Box Conditions to omit spots for any "Unmarried Couple" or "Never Married" couple.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Peter Collier
Famous
Posts: 191
Joined: 04 Nov 2015 17:32
Family Historian: V7
Location: Worcestershire, UK

Re: Conditional expressions for diagram icons

Post by Peter Collier » 23 Dec 2021 21:49

In short, for any n marriages indicated, you can't tell if there is an n+1 or n+... marriage missing.

The spots are one of those things that, in an earlier form, originally served a different and now redundant purpose but persist because, thanks to the wonders of mission creep, they have evolved in scope and so still have some use and, well, I'm used to them. They do have their flaws though, such as outlined in my OP and the one you have just highlighted and as the saying goes, "I wouldn't start from here". Whether the reluctance on my part to tear it up and start over is down to my familiarity with the existing, inertia, or just laziness I don't know.

The idea to also indicate missing citations is a good one, and it would be easy enough to use a different shape icon or some such to distinguish them. How would you best code an expression to achieve that? Is there an opposite function to =ContainsText, or would you need to nest the original expression inside a NOT to negate it? That said, it still wouldn't solve the issue from the OP, which was an overcount of marriages (because of the dependence on interrogating a family record), not an undercount.
Peter Collier

Collier, Savory, Buckerfield, Edmonds, Low, Dungey, Lester, Chambers, Walshe, Moylan, Bradley, Connors, Udale, Wilson, Benfield, Downey

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Conditional expressions for diagram icons

Post by tatewise » 23 Dec 2021 22:41

To make the partnership spots complete you would need to include the Never Married/Unmarried Couple with say a white spot and digit that is different from the Marriage missing and Marriage cited spots.

Those would use:
=IsTrue( FindText( ToLower( FieldText( %INDI%,'INDI.FAMS[1]>_STAT' ) ),"married",1 ) > 0 ) ) to detect both 'Never Married' and 'Unmarried Couple'.
Unfortunately, ContainsText(...) does not work here as _STAT is not a text field.)
You would need five of them to produce say a white spot with the FAMS index numbers [1] to [5].

To identify missing Marriages use the expression below and repeat for [1] to [5] to produce say blue spots:
=IsTrue( ( FindText( ToLower( FieldText( %INDI%,'INDI.FAMS[1]>_STAT' ) ),"married",1 ) = 0 ) and Not(ContainsText(%INDI.FAMS[1]>MARR.SOUR>ABBR%,"M. Re",STD)) )

To identify cited Marriages use your existing ten expressions to produce green spots or green rings.

Remember to enter each of the four Expressions using [1] first, then the four using [2], and so on to ensure the spots are all shown in numerical order.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
Peter Collier
Famous
Posts: 191
Joined: 04 Nov 2015 17:32
Family Historian: V7
Location: Worcestershire, UK

Re: Conditional expressions for diagram icons

Post by Peter Collier » 24 Dec 2021 01:29

I couldn't get =IsTrue( FindText( ToLower( FieldText( %INDI%,'INDI.FAMS[1]>_STAT' ) ),"married",1 ) > 0 ) ) to work, the program just reports an invalid expression.

I therefore tried the following. It's less elegant, but it seemed to do the trick:
=Bool(IsTrue(%INDI.FAMS>_STAT[n]% = "Unmarried Couple") or IsTrue(%INDI.FAMS[n]>_STAT% = "Never Married"))

Quick side question here: I first tried my expression without nesting it in a Bool function, but the computer said "no". I would have expected just to be able to concatenate two expressions with a logical operator (or, in this instance), but that doesn't appear to be the case. Is Bool always neccessary in these circumstances?
Peter Collier

Collier, Savory, Buckerfield, Edmonds, Low, Dungey, Lester, Chambers, Walshe, Moylan, Bradley, Connors, Udale, Wilson, Benfield, Downey

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Conditional expressions for diagram icons

Post by tatewise » 24 Dec 2021 12:11

Sorry, my =IsTrue( ... ) expression has a rogue extra closing bracket on the end :oops:
I should have done what I tell everyone else to do and counted the opening and closing brackets.
=IsTrue( FindText( ToLower( FieldText( %INDI%,'INDI.FAMS[n]>_STAT' ) ),"married",1 ) > 0 ) works.

Yes, =Bool( ... ) or =IsTrue( ... ) are required to encapsulate logical expressions, but you don't need both.
This works:
=Bool( (%INDI.FAMS[n]>_STAT% = "Unmarried Couple") or (%INDI.FAMS[n]>_STAT% = "Never Married") )
and so does:
=IsTrue( (%INDI.FAMS[n]>_STAT% = "Unmarried Couple") or (%INDI.FAMS[n]>_STAT% = "Never Married") )

BTW: For me, your expression worked, so I don't understand why yours was rejected:
=Bool(IsTrue(%INDI.FAMS[n]>_STAT% = "Unmarried Couple") or IsTrue(%INDI.FAMS[n]>_STAT% = "Never Married"))
Ah! I see it now. You have the [n] on _STAT instead of FAMS in the first IsTrue.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply