* Record Flags, Icons and Diagrams

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.
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise »

MARR.DATE is true if ANY date is recorded.
It does not matter whether it is a full day/month/year, Quarter Date, year only, Period date, Range date, Date Phrase, etc.
It is possible to test the format of the Date, and we could explore that, but it gets a bit tricky.

That is why the Expressions posted earlier involve the Source Citation Title (SOUR>TITL) or the Source Type (SOUR>_TYPE).
Then it can differentiate between facts with no citation, or with a GRO Index citation, or with a Certificate citation.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
lesleyl
Diamond
Posts: 74
Joined: 01 Feb 2004 13:03
Family Historian: V7
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl »

I know that almost a year has elapsed! I have worked intermittently at establishing the diagram icons using Expressions and they are working well for census entries but I can't get to grips with the following:
  • Early death - where a child dies under 5
  • Using the sources title to differentiate between a certificate (entered with AS) and a GRO entry.
    I assume that I need to use something like the the example used for baptism =ContainsText( %INDI.BAPM.SOUR>TITL%, "Baptism", STD), what does STD mean and do I need it for a marriage cert?
I would be very grateful for help
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise »

  • Early death - where a child dies under 5
    This hinges on how you have recorded those deaths.
    Have you used the Death Age field and with what values?
    Have you entered the Death Date and also the Birth Date?
    The sort of expressions are =IsTrue(%INDI.DEAT.AGE% <= 5) or =IsTrue(AgeAt(%INDI%,%INDI.DEAT.DATE%) <= 5)
  • Using the source's title to differentiate between a certificate (entered with AS) and a GRO entry.
    Yes, you are on the right line. Check the FH Help page for Functions where ContainsText explains such things as STD.
    ( i.e. Use FH Help > Help Search and enter Function ContainsText )
    e.g. =ContainsText( %CUR~FAMS>MARR.SOUR>TITL%, "Marriage Certificate", STD)
    You can also test the Generic Source Type if you use that and have different values for Certificates and GRO entries.
    e.g. =ContainsText( %CUR~FAMS>MARR.SOUR>_TYPE%, "Marriage Certificate", STD)
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
lesleyl
Diamond
Posts: 74
Joined: 01 Feb 2004 13:03
Family Historian: V7
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl »

Thanks very much Mike

Marriage Certificate is now working, thank you . That means I think that I should be able to work out how to do the Birth & Death Certificates in the same way. I'm slowly getting there!

With regard to the Early death: I have been entering the age as given on the cert or burial entry via AS. That can be in months, so I suspect that I actually need to use the 0 (for those dying under 1) ?
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise »

In was wrong about using the =IsTrue(%INDI.DEAT.AGE% <= 5)
The AGE field is quite complex and can include days, months, and years, optionally with less than or greater than conditions, or even special values such as Child or Infant.
So testing the %INDI.DEAT.AGE% field is almost impossible without an extremely complex expression.

Focus on the =IsTrue(AgeAt(%INDI%,%INDI.DEAT.DATE%) <= 5) or whatever Age limit you want.
However, that does rely on both the Birth event and the Death event having a Date defined.

Alternatively, you will have to add an Early Death flag to the Individual record or the Death fact and test that.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
lesleyl
Diamond
Posts: 74
Joined: 01 Feb 2004 13:03
Family Historian: V7
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl »

Thanks Mike, I'll have a 'play'..... I'm currently adding it by hand anyway, so if all else fails I'll continue with that.
I've managed to create the expression to add a Cremation (because burial didn't cover that), so am beginning to feel that my understanding of expressions is improving
avatar
lesleyl
Diamond
Posts: 74
Joined: 01 Feb 2004 13:03
Family Historian: V7
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl »

I've managed to sort out all the flags and icons that I wanted to use, and I'm really pleased with the result; thank you Mike.
I just have one more question to ask!

(1) As suggested, I have used %INDI.BIRT.DATE:YEAR% to indicate that I have found a birth date from somewhere that requires more investigation.
(2) The trouble is that if I find the GRO ref and use =ContainsText(%INDI.BIRT.SOUR>TITL%,"GRO-B",STD) to display the fact that it's cited and sourced, I still get the icon from (1) above as well.

I'm coming round to thinking that if I've got the expression in (2) and a similar one =ContainsText(%INDI.BIRT.SOUR>TITL%,"Birth",STD) for a birth certificate source, the expression in (1) should be redundant. That is, I really shouldn't have a case where a birth year is unsourced, even if it's only from 1939 register, or in the case of pre-registration by calculation from (say) a burial record?
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise »

The thing to remember is that all Box Condition expressions are independent of each other.
So if the Condition is true then the Icon (or other Box Feature) is applied.

Thus your case (1) really needs to test for the Birth Year and no Source Citation such as something like:
=IsTrue( Exists(%INDI.BIRT.DATE:YEAR%) and IsEmpty(%INDI.BIRT.SOUR%) )
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
lesleyl
Diamond
Posts: 74
Joined: 01 Feb 2004 13:03
Family Historian: V7
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl »

Thanks Mike. That sort of expression looks as if it will be a brilliant addition!
avatar
lesleyl
Diamond
Posts: 74
Joined: 01 Feb 2004 13:03
Family Historian: V7
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl »

Hi Mike, sorry to resurrect this! I've been getting on well with using expressions as tutored by you, but have come across one I can't sort out :)

As I'm now further back with my ONS, I want to make a change to this one so that the early dates don't have a flag that indicates a missing birth source to me
=IsTrue( Exists(%INDI.BIRT.DATE:YEAR%) and IsEmpty(%INDI.BIRT.SOUR%) )
so that the icon only displays if the birth year is after 1837.

I tried
=IsTrue(Year(%INDI.BIRT.DATE%)>=1837) and IsEmpty(%INDI.BIRT.SOUR%)
but it's coming up with an invalid expression.
What am I doing wrong - I'm sure that it's something stupid!
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise »

It is a problem with parentheses.

Your original expression was:
=IsTrue( Exists(%INDI.BIRT.DATE:YEAR%) and IsEmpty(%INDI.BIRT.SOUR%) )
Here the =IsTrue(...) function encloses both the the other functions.

Your revised expression does not:
=IsTrue( Year(%INDI.BIRT.DATE%)>=1837 ) and IsEmpty(%INDI.BIRT.SOUR%)
The and IsEmpty(...) function is left dangling outside the =IsTrue(...) function.

So you need to move the closing parenthesis back to the end of the expression:
=IsTrue( Year(%INDI.BIRT.DATE%)>=1837 and IsEmpty(%INDI.BIRT.SOUR%) )
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
lesleyl
Diamond
Posts: 74
Joined: 01 Feb 2004 13:03
Family Historian: V7
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl »

Thank you Mike!
I had looked at it and counted and even resorted to colouring the brackets, but obviously made a mistake & still couldn't spot the error!
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise »

Yes, counting the parentheses is a useful check, but you must also ensure that all the parameters for each function are inside their pair of parentheses.

In this case, the =IsTrue(...) function must enclose both the boolean expressions separated by and.
i.e. =IsTrue( expression1 and expression2 )
where:
Boolean expression1 was Exists(%INDI.BIRT.DATE:YEAR%) and now is Year(%INDI.BIRT.DATE%)>=1837
Boolean expression2 was and is IsEmpty(%INDI.BIRT.SOUR%)
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
davidf
Megastar
Posts: 951
Joined: 17 Jan 2009 19:14
Family Historian: V6.2
Location: UK

Re: Record Flags, Icons and Diagrams

Post by davidf »

Is there a potential wish list item - possibly as the beginning of a syntax checker?

Could paired parentheses take the same colour?
e.g.
=IsTrue( Exists(%INDI.BIRT.DATE:YEAR%) and IsEmpty(%INDI.BIRT.SOUR%) )

The logic for determining the colour is not quite as straight forward as may be first thought. You could have an array of colours [red blue magenta green etc.] and how far you index into the colours depends on the depth of parentheses but in the example above that would result in (%INDI.BIRT.DATE:YEAR%) and (%INDI.BIRT.SOUR%) both taking the same colour; so you don't want to have an "opening colour" that matches the previous "closing colour" so the "rule" has to say if a colour is immediately repeated you "double index" - and the "colour" consequently does not match the depth of parentheses.

Open with Colour1 =IsTrue(
Open with Colour2 Year(%INDI.BIRT.DATE:YEAR%
Close with Colour2 )
Because Colour 2 has just closed you now have to open with colour 3
Open with Colour3 and IsEmpty(%INDI.BIRT.SOUR%
Close with Colour3 )
Close with Colour1 )

I would then advocate that a function associated with an opening parenthesis should take that colour as well, so you would get:

=IsTrue( Exists(%INDI.BIRT.DATE:YEAR%) and IsEmpty(%INDI.BIRT.SOUR%) )

Given this sort of thing is in many programming editors, I suspect that this functionality may exist as a library - but how easy it would be to get it to parse fh functions is beyond my pay grade!

Is this worth pursuing?
David
Running FH 6.2.7. Under Wine on Linux (Ubuntu 22.04 LTS + LXDE 11)
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise »

David, unfortunately, expression syntax analysis is a bit more complex than that.

Lesley had already applied that count and colour parentheses technique to no avail.
e.g. The coloured function parentheses in Lesley's expression look OK but are syntactically in error:
=IsTrue( Year(%INDI.BIRT.DATE%)>=1837 ) and IsEmpty(%INDI.BIRT.SOUR%)

Performing the syntax analysis is hard enough, but showing the user where the error exists is even more difficult.
It is not clear how your coloured function parenthesis technique would identify the error.
In the above example, the crucial mistake is the word and not being enclosed within any parentheses.
FH already reports when the syntax is invalid. Reporting the position of the error is the difficult bit.

There is Wish List Ref 41 Wizard to help create queries that touches on this topic and has many useful comments, especially regarding PSPad. Perhaps it could be rescoped to something like Wizard/Analyser to help create Expressions.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
davidf
Megastar
Posts: 951
Joined: 17 Jan 2009 19:14
Family Historian: V6.2
Location: UK

Re: Record Flags, Icons and Diagrams

Post by davidf »

I agree with what you say Mike, and I did say "possibly as the beginning of a syntax checker?"

The benefit of at least colouring up the parentheses is it becomes easier to see the things and to pair them up! In the example you quote for "Lesley's expression" you can at least see that the IsTrue function only reaches half-way through the expression - which helps with (human) error checking!

PSPad (with FH Expressions) does not seem to do quite what I had in mind as parentheses are not paired up by colour (although when you highlight one - the corresponding one is also highlighted).
David
Running FH 6.2.7. Under Wine on Linux (Ubuntu 22.04 LTS + LXDE 11)
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise »

That colouring technique did not help Lesley who said:
I had looked at it and counted and even resorted to colouring the brackets, but obviously made a mistake & still couldn't spot the error!
David, it is not clear what your algorithm does when the parentheses are not matched correctly.
Could you give some exmaples?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
davidf
Megastar
Posts: 951
Joined: 17 Jan 2009 19:14
Family Historian: V6.2
Location: UK

Re: Record Flags, Icons and Diagrams

Post by davidf »

tatewise wrote: 08 Jun 2022 11:55 David, it is not clear what your algorithm does when the parentheses are not matched correctly.
Could you give some exmaples?
The algorithm only colours the parentheses - it does not "do" anything when parentheses are not matched - that is up to the human. The colouring just makes it easier to spot unmatched parentheses.

=IsTrue( Year(%INDI.BIRT.DATE%)>=1837 and IsEmpty(%INDI.BIRT.SOUR%)

Visual inspection shows that the opening red parenthesis has not been closed - so the question then - for the human - is where to put the missing )

=IsTrue( Year(%INDI.BIRT.DATE%) >=1837 and IsEmpty(%INDI.BIRT.SOUR%) ) )

Visual inspection shows that there is an additional unmatched closing parenthesis at the end.

It will not flag incorrect syntax, but (despite not working for Lesley) can help spot unmatched parentheses and help to manually check the syntax of functions, because you can see what is within the function - working from the inside out. (But then I like RPN!)
David
Running FH 6.2.7. Under Wine on Linux (Ubuntu 22.04 LTS + LXDE 11)
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise »

What would your algorithm make of the slightly unusual but perfectly valid expression:

=IsTrue( ( %INDI.BIRT.NOTE2% = " Year( " ) and IsEmpty( %INDI.BIRT.SOUR% ) )
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
davidf
Megastar
Posts: 951
Joined: 17 Jan 2009 19:14
Family Historian: V6.2
Location: UK

Re: Record Flags, Icons and Diagrams

Post by davidf »

=IsTrue( ( %INDI.BIRT.NOTE2% = " Year( " ) and IsEmpty( %INDI.BIRT.SOUR% ) )
Because "Year( " is not functionally an opening parenthesis (due to being within quotes) and the parsing algorithm ignores it?

But colour coding opening and closing quotes may make everything too messy!
David
Running FH 6.2.7. Under Wine on Linux (Ubuntu 22.04 LTS + LXDE 11)
avatar
lesleyl
Diamond
Posts: 74
Joined: 01 Feb 2004 13:03
Family Historian: V7
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl »

Hi Mike
Following on from all the help you gave me to get this up and running, I was so pleased with the result.
Since then, I've successfully merged two projects and updated to ver 7.

However, today I think I have committed a big boo-boo, which I suspect is going to involve me entering all the expressions again ..... and I stupidly didn't take a backup or make a copy of the project first......

My aim was to create a custom descendant diagram that didn't include all the flags & icons.:
(1) I copied the descendant diagram for the person, and saved it as a Descendant_no flags using Custom Diagram Type. At this point it still had all the flags etc
(2) I used the new, saved customised diagram and removed the flags and expressions that generated the icons from the Diagram Options> Boxes and resaved it as Desecendant_no flags using the Custom Diagram Type. Brilliant - looked fine...

BUT, now none of my standard diagrams are displaying the icons and when I go into ANY of the charts, the icons are missing :(
What have I done and is it rectifiable given that I haven't done a backup for a while (yes I know, slapped wrists!)? If I have to reenter the expressions again, so be it, but I don't understand what i did that caused such a catastrophic change.
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise »

If I understand correctly, in your standard Diagrams, the Diagram > Options > Boxes tab has no Condition Expressions at all.

The only way I can think that has happened is if you clicked the Set as defaults... link in the bottom left-hand corner of the Diagram Options window after you deleted the Condition Expressions from the Custom Diagram.

Note that the standard Diagrams do not have that link but a Remember Options tick box instead.

My advice is to never rely on customisations in the standard Diagrams. Always save as a Custom Diagram Type and keep the standard Diagrams in their default configuration. Remember also that any customisation changes to any one standard Diagram affect all the standard Diagrams.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
lesleyl
Diamond
Posts: 74
Joined: 01 Feb 2004 13:03
Family Historian: V7
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl »

Correct - no Condition Expressions at all! And no custom flags either :(

My advice is to never rely on customisations in the standard Diagrams. Always save as a Custom Diagram Type and keep the standard Diagrams in their default configuration. Remember also that any customisation changes to any one standard Diagram affect all the standard Diagrams.

That's exactly what I thought I had done - I made a copy and saved it as a Custom Diagram Type so that the Standard one stayed with flags. Was I right in doing that?

Thanks Mike - I must have Set as Default, though it's something I would normally avoid clicking like the plague!

One flash of inspiration - I still have v6 on my laptop and the backup from before the upgrade. At least that would let me see all the expressions I created wouldn't it?
User avatar
LornaCraig
Megastar
Posts: 3201
Joined: 11 Jan 2005 17:36
Family Historian: V7
Location: Oxfordshire, UK

Re: Record Flags, Icons and Diagrams

Post by LornaCraig »

is it rectifiable given that I haven't done a backup for a while ...
Do you happen to have any saved Charts (not the same thing as diagram types) and, if so, do they have all the required box conditions? If you have any they will be under Charts > Saved Charts.
It would be possible to recover the box conditions from a saved Chart by saving it as a new custom diagram type.
Lorna
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise »

You must have some time ago customised the standard Diagrams to add the Boxes tab Condition Expressions.
i.e. The standard Diagrams did not then have their default settings.
At that point, you should have saved a Custom Diagram Type with the Icon customisations and restored the standard Diagrams to their default installation settings.

Then you would have a Custom Diagram Type safely saved with all the non-default customisations.

That Custom Diagram Type would be the starting point for your recent changes by copying it to another Custom Diagram Type and removing the Boxes Conditions for the Icons, etc.

If you have FH V6 on your laptop then backups are irrelevant. The customised Diagrams should still exist in FH.

BTW: What sort of backups are you talking about? Project Backups or Backup and Restore FH Settings plugin backups?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Post Reply