* Using expressions

Questions regarding use of any Version of Family Historian. Please ensure you have set your Version of Family Historian in your Profile
avatar
londonscorpion
Diamond
Posts: 66
Joined: 19 Oct 2010 13:50
Family Historian: V6.2

Using expressions

Post by londonscorpion » 04 May 2015 13:58

I have successfully created expressions for Census 1911, Birth, Baptism and Death all of which work in both FH5 and FH6:

=IsTrue(%INDI.CENS[year=1911].SOUR>_TYPE% = "Census")

=ContainsText(%INDI.BIRT.SOUR>TITL%,"Birth",STD)

=ContainsText(%INDI.BAPM.SOUR>TITL%,"Baptism",STD)

=ContainsText(%INDI.DEAT.SOUR>TITL%,"Death",STD)


However the following expression for Marriage works in FH5 but not in FH6:

=ContainsText(%FAM.MARR.SOUR>TITL%,"Marriage",STD)

Can anyone help?

User avatar
davidm_uk
Megastar
Posts: 735
Joined: 20 Mar 2004 12:33
Family Historian: V6.2
Location: St Albans, Hertfordshire, UK

Re: Using expressions

Post by davidm_uk » 04 May 2015 15:10

This works for me for a source title containing "Marriage Index"

=ContainsText(%INDI.FAMS>MARR.SOUR>TITL%,"Marriage Index",STD)
David Miller - researching Miller, Hare, Walker, Bright (mostly Herts, Beds, Dorset and London)

User avatar
Jane
Site Admin
Posts: 8017
Joined: 01 Nov 2002 15:00
Family Historian: V6.2
Location: Somerset, England
Contact:

Re: Using expressions

Post by Jane » 04 May 2015 15:21

If you are using the expressions for using box controls on diagrams, consider using the new CUR_FAM option.

Current Family As Spouse %CUR_FAMS>% yes Diagrams - text templates and box conditions

See the Understanding Data references FH help article for more information
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 18917
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Using expressions

Post by tatewise » 04 May 2015 15:28

I am guessing from a previous posting that this applies to Diagram Box Condition Expressions.

David's solution works, but is unreliably if Individual has multiple FAMily as Spouse relations, because it only tests %INDI.FAMS[1]>MARR%, whereas it could be the 2nd or 3rd partnership that is being displayed in Diagram.

What you need is the new FH V6 Contextual Data Reference:
=ContainsText(%CUR_FAMS>MARR.SOUR>TITL%,"Marriage",STD)
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
londonscorpion
Diamond
Posts: 66
Joined: 19 Oct 2010 13:50
Family Historian: V6.2

Re: Using expressions

Post by londonscorpion » 04 May 2015 15:44

Many thanks to all, that has nailed it.

But the question still remains "why my original does not work in FH6". I would never have thought that a new function was needed. Should not Calico Pie have brought this to our attention ??

User avatar
tatewise
Megastar
Posts: 18917
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Using expressions

Post by tatewise » 04 May 2015 15:50

Calico Pie did in http://www.family-historian.co.uk/featu ... -version-6.
It is the first item under Enhancements for Power-Users.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
londonscorpion
Diamond
Posts: 66
Joined: 19 Oct 2010 13:50
Family Historian: V6.2

Re: Using expressions

Post by londonscorpion » 04 May 2015 15:57

Mike I did read that but I did not interpret it as meaning that an existing function would no longer work.

As a matter of interest, if I drop Diagram Flags in favour of Expressions, how would I proceed, in the future, in updating my named lists of birth, marriage and death certificates for which I currently use the Has Flag query. Is there an equivalent query for "Has Expression"?

User avatar
tatewise
Megastar
Posts: 18917
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Using expressions

Post by tatewise » 04 May 2015 16:23

I think the problem is a side-effect of Box Condition Expressions introduced with FH V4.
The problem is that %FAM...% is potentially ambigous in a Diagram.
Which FAMily is it meant to refer to when there are multiple possibilites.
I think it works in FH V4/V5 because they ignore the context and just plump for the first Family instance, which is usually correct, and even when incorrect may produce the same result if, for example, all the Family Marriages have similar Source details.

The answer to your later question is in the Knowledge Base > Using Flags and Icons and Expressions advice, where it suggests that similar Expressions can be used in Record Window Columns and in Queries.

You have not explained the purpose of your Named Lists. If they are purely an aide memoire then are they really necessary? Perhaps Record Window Columns would be better? There you enter an Expression similar to your Diagram Box Condition. The result is either true or false (just like Has Flag) and displays either Y or nothing.

So in Individual Records Window with =ContainsText(%INDI.BIRT.SOUR>TITL%,"Birth",STD) in a column headed Birth Cert., it shows Y in rows that do, and a click on the column heading will bring all those to the top of the list. Repeat that in similar columns for other conditions.

The only caveat is for FAMily Facts such as MARRiage.
This is where you would use David's expression for the 1st Spouse, but would need to add conditions for the 2nd, 3rd, and more, depending how many multiple spouses exist in your data. How did you deal with this with Individual Record Flags, because I don't think it is possible.

An alternative and neater solution is to use the Family Records Window and use a simple =ContainsText(%FAM.MARR.SOUR>TITL%,"Birth",STD) expression that tests each partnership.

If you really need Named Lists then Queries using similar Expressions will be needed.

But the big benefit is you never have to keep setting and clearing Flags when your data changes, as the Expressions will always reflect the current situation. That is why Record Window Columns are better than Named Lists, because the Columns are always correct, whereas Named Lists need you to run a Query.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
londonscorpion
Diamond
Posts: 66
Joined: 19 Oct 2010 13:50
Family Historian: V6.2

Re: Using expressions

Post by londonscorpion » 04 May 2015 17:25

Thanks for that very comprehensive explanation. One of my uses for named lists is to control the aquisition of certificates. For each of the three main types of certificate I have lists for individuals where I have found an Index, where I have ordered a certificate and where I have physically received a certifiicate. I use flags so that diagrams will show what the research status for any individual is. I manually update the named lists for the indexes found and certs ordered and received, and then use the adjusted lists to update the flags. The lists also provide me with a quick check on the certs I have.

You are right to suggest I had a problem where an individual had married more than once. I just lived with it!!

I've been looking for the Family Records Window but to no avail. Where is it?

User avatar
davidm_uk
Megastar
Posts: 735
Joined: 20 Mar 2004 12:33
Family Historian: V6.2
Location: St Albans, Hertfordshire, UK

Re: Using expressions

Post by davidm_uk » 04 May 2015 17:33

If it's not already shown as a tab in the main Records Window go to Tools-Preferences-Records Window and in there under Families, change to Always Show.
David Miller - researching Miller, Hare, Walker, Bright (mostly Herts, Beds, Dorset and London)

avatar
londonscorpion
Diamond
Posts: 66
Joined: 19 Oct 2010 13:50
Family Historian: V6.2

Re: Using expressions

Post by londonscorpion » 04 May 2015 17:39

Thanks David. Every day a liitle bit more !!!

User avatar
tatewise
Megastar
Posts: 18917
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Using expressions

Post by tatewise » 04 May 2015 18:21

I have never understood why FH hides some of the Records Window tabs by default. I always have them all shown.

Maybe a refinement of the Expressions and use of Sources would achieve what you want without Named Lists or Flags.
e.g.
When you find an Index create & cite the Source and set its Type to Birth Index.
When you order the Certificate change the Source Type to Birth Ordered.
When you get the Certificate change the Source Type to Birth Certificate.
(Similarly use Death ... and Marriage ... for those events.)
At each step you probably already refer to details that would be recorded in the Source eventually so why not do it as you go along and just change the Type at the same time.

To monitor status you need three Diagram Box Condition Expressions just like you had three Flags, and each one tests for Source Type (_TYPE) containing Birth Index/Ordered/Certificate, etc, and yields the associated icon.

The Records Window Column Expression could be much simpler. It just displays the Source Type in the column so get an instant indication of status, and can sort so that all Birth Index and all Birth Ordered and all Birth Certificate are grouped together.

I hope that all makes sense.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
londonscorpion
Diamond
Posts: 66
Joined: 19 Oct 2010 13:50
Family Historian: V6.2

Re: Using expressions

Post by londonscorpion » 05 May 2015 09:32

Thanks for the advice and I will start to implement that today.

avatar
londonscorpion
Diamond
Posts: 66
Joined: 19 Oct 2010 13:50
Family Historian: V6.2

Re: Using expressions

Post by londonscorpion » 07 May 2015 18:02

Mike, I have started to implement Expressions and replace my Flags. I have come across an extra requirement that using Expression imposes. I use different icons to visualise on diagrams Indexes, Ordered Certs, and Received Certs, so in addition to changing the Source Type (from say Birth Index to Ordered Birth Cert, I would also have to change the icon for the expression. This is no real problem but it is an extra thing to do. Tell me if there is a way around this.

User avatar
tatewise
Megastar
Posts: 18917
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Using expressions

Post by tatewise » 07 May 2015 20:13

I presume for Birth Events you have something similar to the following three Condition Expressions:
  1. =IsTrue(%INDI.BIRT.SOUR>_TYPE% = "Birth Index")
  2. =IsTrue(%INDI.BIRT.SOUR>_TYPE% = "Ordered Birth Cert")
  3. =IsTrue(%INDI.BIRT.SOUR>_TYPE% = "Birth Certificate")
Each one will have a different Feature Icon.

That pattern will repeat for every other type of Event.

Presumably previously you had three Condition Record Flag entries with a different Feature Icon for each one, so the concept is the same, but with three Condition Expressions instead.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
arishmell
Diamond
Posts: 73
Joined: 29 Jan 2005 19:13
Family Historian: V6.2

Re: Using expressions

Post by arishmell » 08 May 2015 11:19

I've learnt a lot from this thread, and I think my query follows on from this discussion. I like to work from a diagram, and in the past have set flags to attach icons to boxes so I can see all sorts of details at a glance. For example, I have flags to show a different coloured icon for paternal and maternal direct ancestors of myself as File Root. This works well until the tree grows and the flag needs updating.

So I am trying to get my head round expressions. I have successfully used an expression posted by tatewise, =IsAncestorOf(%INDI%,FileRoot()), which indicates all direct line ancestors of the File Root. I wonder is there any way to distinguish paternal and maternal lines? I tried =IsPaternalAncestorOf(%INDI%,FileRoot()) but no such luck. :(

Incidentally, it would be incredibly helpful for those of us who are somewhat "challenged" by things like expressions, if there were some sort of database of common expressions we could consult and copy/paste from. I think I'm getting the hang of using them, but creating them is beyond me.

User avatar
tatewise
Megastar
Posts: 18917
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Using expressions

Post by tatewise » 08 May 2015 12:06

Yes, using Expressions does take some practice, especially those involving Functions. Remember Expressions are a combination of Data Refs, Functions and Operators.

The Knowledge Base > Using Flags and Icons and Expressions and Knowledge Base > Understanding Functions give some advice and worked examples, but it all depends on what you want to achieve.

For a full list of Functions see the FH Help > Using Family Historian > Advanced Topics > Understanding Functions where it also explains Data Types, Operators, Constants, Conditional Expressions, etc.

Taking your objective, you discovered =IsAncestorOf() and a check of the above Help would reveal there is no =IsPaternalAncestorOf() Function.

=IsAncestorOf( %INDI%, FileRoot() ) works for the File Root, so we need to consider how the 2nd parameter FileRoot() could become the Father of File Root.

Well we know the Data Ref for a Father is INDI.FAMC>HUSB>.
So we can use the =Field() Function to obtain the Father of File Root:
=Field( FileRoot(), 'INDI.FAMC>HUSB>' )
and thus all his ancestors are:
=IsAncestorOf( %INDI%, Field( FileRoot(), 'INDI.FAMC>HUSB>' ) )

Similarly, the ancestors of Mother of File Root are:
=IsAncestorOf( %INDI%, Field( FileRoot(), 'INDI.FAMC>WIFE>' ) )

Those Expressions do NOT include the Father and Mother themselves, but I suspect that is unimportant.

The above assumes the natural parents are the 1st Family as Child FAMC[1] whereas adoptive/foster parents would typically be 2nd Family as Child FAMC[2] and could have their own icons using similar Expressions.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
arishmell
Diamond
Posts: 73
Joined: 29 Jan 2005 19:13
Family Historian: V6.2

Re: Using expressions

Post by arishmell » 08 May 2015 18:24

Mike, that is brilliant! Thank you so much! Little coloured dots all the way to the very tops of the trees!

And thank you for explaining it all in (relatively) simple language. Now to tackle censuses and certificates. I may be back!

User avatar
tatewise
Megastar
Posts: 18917
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Using expressions

Post by tatewise » 08 May 2015 21:38

I have started Knowledge Base > Understanding Expressions that cross-references related topics and lists example Expressions that can be expanded over time.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
arishmell
Diamond
Posts: 73
Joined: 29 Jan 2005 19:13
Family Historian: V6.2

Re: Using expressions

Post by arishmell » 09 May 2015 05:47

Mike, you have a big heart! Your efforts here are remarkable.

I have already made a successful start on replacing my census flags with expressions but have run into a problem. I use coloured icons to differentiate between locations: buff for UK censuses, blue for US and red for Canadian censuses. I think the US censuses won't be a problem because the census year is different from the UK censuses so I can simply change the date number. But how do I distinguish the Canadian and UK censuses, held in the same years?

User avatar
johnmorrisoniom
Megastar
Posts: 792
Joined: 18 Dec 2008 07:40
Family Historian: V6.2
Location: Isle of Man

Re: Using expressions

Post by johnmorrisoniom » 09 May 2015 06:24

I make sure that the word "Canada" or "UK" (In my case I use "England") and use an expression that relies on that word to set an appropriate icon.
I have one expression per country per census year. (I have different icons for England, Ireland, Scotland, Wales , Isle of man and USA, so have about 60 expressions for census alone.

E.G. for Canada 1901

=ContainsText(%INDI.CENS[year=1901].SOUR>TITL%,"Canada",STD)

just modify the year and country to suit.

User avatar
tatewise
Megastar
Posts: 18917
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Using expressions

Post by tatewise » 09 May 2015 09:12

The specific solution depends on exactly what you record: Method 1 Source Citations, Method 2 Source Citations, no Citations at all, and where you mention Canada. See Knowledge Base > Understanding Expressions Source Citation Fields.

Some combination of the following should work:

=IsTrue( %INDI.CENS[year=1901].SOUR>_TYPE% = "Canada Census" )

=ContainsText( %INDI.CENS[year=1901].SOUR>TITL%, "Canada", STD )

=ContainsText( %INDI.CENS[year=1901].PLAC%, "Canada", STD )

Each Data Reference refers to a different field:

%INDI.CENS[year=1901].SOUR>_TYPE% is 1901 Census 1st Citation Source Type field.

%INDI.CENS[year=1901].SOUR>TITL% is 1901 Census 1st Citation Source Titel/Name field.

%INDI.CENS[year=1901].PLAC% is 1901 Census Place field (but does NOT check Citations).

Each Function tests different characteristics:

=IsTrue( ... = "Canada Census" ) tests if field contents equals "Canada Census".

=ContainsText( ..., "Canada", STD ) tests if field contents contains "Canada" somewhere.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
londonscorpion
Diamond
Posts: 66
Joined: 19 Oct 2010 13:50
Family Historian: V6.2

Re: Using expressions

Post by londonscorpion » 09 May 2015 09:18

Mike, Re your post of 7 May. My silly oversight! All is now implemeted and working well. Again, a brilliant effort and I hope others benefit.

avatar
londonscorpion
Diamond
Posts: 66
Joined: 19 Oct 2010 13:50
Family Historian: V6.2

Re: Using expressions

Post by londonscorpion » 11 May 2015 12:26

This morning I loaded up a chart that I had brought across from V5. Now all my new expressions that I created in V6 have disappeared. I note too that all the old flags which I had deleted in V6 have reappeared. That is a lot of work to redo and I am not a happy bunny. What has happened and how do I recover the situation.

User avatar
LornaCraig
Megastar
Posts: 1770
Joined: 11 Jan 2005 17:36
Family Historian: V6.2
Location: Oxfordshire, UK

Re: Using expressions

Post by LornaCraig » 11 May 2015 13:33

When you save a chart you save all aspects of it, including the Text scheme and the Boxes scheme. So when you open the chart you saved with the old box conditions and flags, that is what you will get. (The idea is that you can apply different schemes to different charts, and you might have been quite annoyed if you had opened an old chart and found it automatically converted to the new scheme!)

When you developed a new boxes scheme using Expressions, did you save the new scheme as the default, or at least save a diagram as a Custom Diagram Type or a new Chart using those new settings? If so the new scheme is still available. Depending on how much other customisation there was in the V5 chart it may be quicker to re-create it under the new scheme than change its box conditions.
Lorna

Post Reply