* Diagram Expressions / Icons / Contains Place

Questions regarding use of any Version of Family Historian. Please ensure you have set your Version of Family Historian in your Profile
Post Reply
avatar
MB@RE
Platinum
Posts: 45
Joined: 14 Sep 2013 11:04
Family Historian: V6
Location: Warwickshire

Diagram Expressions / Icons / Contains Place

Post by MB@RE » 19 Sep 2020 10:29

Hello,

Apologies if this has been covered before, I think the nearest post may have been :

Diagram Icons: Flags -> Expressions (15078)

I've been trying to write an expression so I can use the census dates and places. So I have a different icon for a 1911 census in England and another for Canada, etc.

Would someone please put me right on this. The expression i've used (below) doesn't work :

=ISTRUE((%INDI.CENS[YEAR=1911]%) AND (%INDI.CENS[YEAR=1911].PLAC>CONTAINS"ENGLAND"%))

Thanking you for your help.

Best regards,
Mike
Mike Burditt researching BURDITTs of Leic/Northants and WEBSTERs of Lancs

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

Re: Diagram Expressions / Icons / Contains Place

Post by tatewise » 19 Sep 2020 10:52

Checkout Knowledge Base > Understanding Expressions where there are various examples of using the CENS[year=1900] in combination with the ContainsText(...) function.

So your expressions would become:

=ContainsText( %INDI.CENS[year=1911].PLAC%, ", England" ) for the England 1911 Census

=ContainsText( %INDI.CENS[year=1911].PLAC%, ", Canada" ) for the Canada 1911 Census

The test for %INDI.CENS[year=1911]% separately is redundant, because if that does not exist then its Place field won't exist and ContainsText will return false the same as if the Census Place did exist but for a different country.
i.e. The expression says: If a 1911 Census Event has a Place field that contains "XYZ" then return true, otherwise false.

Notice that it is probably important to include the comma that precedes the country.
Otherwise, if a 1911 Census Place in Canada has England somewhere in its name then that will match by mistake.
Unforunately, even that may not be totally foolproof.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
MB@RE
Platinum
Posts: 45
Joined: 14 Sep 2013 11:04
Family Historian: V6
Location: Warwickshire

Re: Diagram Expressions / Icons / Contains Place

Post by MB@RE » 19 Sep 2020 11:12

Thank you Mike,

I will indeed look at the knowledge base article.

Makes sense, regarding the redundant census year.
I've tried cutting and pasting the expressions you've kindly made, but for some reason it still shows it's invalid, is it anything to do with the 2nd closed bracket ?

Cheers.
Mike
Mike Burditt researching BURDITTs of Leic/Northants and WEBSTERs of Lancs

avatar
Gowermick
Megastar
Posts: 856
Joined: 13 Oct 2015 07:22
Family Historian: V6.2
Location: Swansea

Re: Diagram Expressions / Icons / Contains Place

Post by Gowermick » 19 Sep 2020 12:24

A good tip when using brackets, is to check that they pair up. So if you have 3 opening brackets, you should have 3 matching closing brackets. This can be easy to miss when using complicated expressions, or cutting and pasting, but is really easy to check.
So the answer to your question is yes, there are too many closing brackets, so delete the one at the extreme right in both expressions.
Mike Loney

Using FH 6.2.7, with CC 6.7.37 Windows 10 Home, LibreOffice (x64), Firefox(x64) & Thunderbird
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com

avatar
MB@RE
Platinum
Posts: 45
Joined: 14 Sep 2013 11:04
Family Historian: V6
Location: Warwickshire

Re: Diagram Expressions / Icons / Contains Place

Post by MB@RE » 19 Sep 2020 13:28

Thanks Mike

Aware of this rule with the likes of Excel.
Hopefully, it won't be long until Mike Tate has come up with a re-working.
I hope where ever the county name is (i.e. in Field 1, Field 2, so on), it will work.

Otherwise, it's a case of keeping the record flags, and running the query each time.
Mike Burditt researching BURDITTs of Leic/Northants and WEBSTERs of Lancs

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

Re: Diagram Expressions / Icons / Contains Place

Post by tatewise » 19 Sep 2020 13:33

Yes, sorry, my typo. I was focussed more on other aspects and forgot to check the brackets.
They are corrected in my original posting and match the KB examples.

It may be more foolproof to check the 1911 Census Source Citation than the Place name.
Some examples are shown in the KB.
e.g. The reference numbers probably have a different format. England & Wales always use the code RG14.
Alternatively, give the Source records differing Type values of Census England and Census Canada.

The only caveat is the Census Event must have the Census Source Citation as the first entry, but that is not a problem.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
MB@RE
Platinum
Posts: 45
Joined: 14 Sep 2013 11:04
Family Historian: V6
Location: Warwickshire

Re: Diagram Expressions / Icons / Contains Place

Post by MB@RE » 19 Sep 2020 15:17

Thanks for your efforts Mike.

Even with the updated expression, the string sadly reads as a non-valid expression.
I will carry on using the record flags and queries, which produces the right results.
I thought using Expressions with the diagram boxes would have made the process more automatic, but the different icons coupled to different countries has made it complicated.

Thanks again.

Mike
Mike Burditt researching BURDITTs of Leic/Northants and WEBSTERs of Lancs

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

Re: Diagram Expressions / Icons / Contains Place

Post by tatewise » 19 Sep 2020 15:29

Sorry, another silly typo, this time the % pairs were not balanced.
Now also corrected in my original posting. Not doing too well today :lol:

As you get into writing Expressions you will get used to spotting those mistakes yourself.
Compare these Expressions with the KB, e.g. =ContainsText( %INDI.BAPM.SOUR>TITL%, "Baptism", STD )

I have to admit that it is a pity FH does not give better syntax error messages.
It should be easy for FH to spot unbalanced pairs of brackets and % symbols and say that is why it is invalid.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
MB@RE
Platinum
Posts: 45
Joined: 14 Sep 2013 11:04
Family Historian: V6
Location: Warwickshire

Re: Diagram Expressions / Icons / Contains Place

Post by MB@RE » 19 Sep 2020 15:50

Appreciate the last update Mike,

It got a result (i.e. diagram icon) when the place name was ",England". Which does the job nicely.
Great work.
Thanks.

Mike
Mike Burditt researching BURDITTs of Leic/Northants and WEBSTERs of Lancs

Post Reply