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

Re: Record Flags, Icons and Diagrams

Post by tatewise » 14 Feb 2021 12:19

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: 56
Joined: 01 Feb 2004 13:03
Family Historian: V6
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl » 21 Jan 2022 12:47

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: 24422
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise » 21 Jan 2022 13:10

  • 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: 56
Joined: 01 Feb 2004 13:03
Family Historian: V6
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl » 21 Jan 2022 15:32

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: 24422
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise » 21 Jan 2022 16:01

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: 56
Joined: 01 Feb 2004 13:03
Family Historian: V6
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl » 21 Jan 2022 16:19

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: 56
Joined: 01 Feb 2004 13:03
Family Historian: V6
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl » 13 Feb 2022 19:14

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: 24422
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise » 13 Feb 2022 19:31

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: 56
Joined: 01 Feb 2004 13:03
Family Historian: V6
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl » 13 Feb 2022 19:53

Thanks Mike. That sort of expression looks as if it will be a brilliant addition!

avatar
lesleyl
Diamond
Posts: 56
Joined: 01 Feb 2004 13:03
Family Historian: V6
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl » 07 Jun 2022 09:56

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: 24422
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise » 07 Jun 2022 10:53

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: 56
Joined: 01 Feb 2004 13:03
Family Historian: V6
Location: Cambridge

Re: Record Flags, Icons and Diagrams

Post by lesleyl » 07 Jun 2022 12:18

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: 24422
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Record Flags, Icons and Diagrams

Post by tatewise » 07 Jun 2022 13:50

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: 594
Joined: 17 Jan 2009 19:14
Family Historian: V6.2
Location: UK

Re: Record Flags, Icons and Diagrams

Post by davidf » 07 Jun 2022 19:46

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 (Lubuntu 18.04 LTS)

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

Re: Record Flags, Icons and Diagrams

Post by tatewise » 08 Jun 2022 09:39

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: 594
Joined: 17 Jan 2009 19:14
Family Historian: V6.2
Location: UK

Re: Record Flags, Icons and Diagrams

Post by davidf » 08 Jun 2022 11:46

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 (Lubuntu 18.04 LTS)

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

Re: Record Flags, Icons and Diagrams

Post by tatewise » 08 Jun 2022 11:55

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: 594
Joined: 17 Jan 2009 19:14
Family Historian: V6.2
Location: UK

Re: Record Flags, Icons and Diagrams

Post by davidf » 08 Jun 2022 12:29

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 (Lubuntu 18.04 LTS)

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

Re: Record Flags, Icons and Diagrams

Post by tatewise » 08 Jun 2022 13:22

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: 594
Joined: 17 Jan 2009 19:14
Family Historian: V6.2
Location: UK

Re: Record Flags, Icons and Diagrams

Post by davidf » 08 Jun 2022 13:50

=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 (Lubuntu 18.04 LTS)

Post Reply