* Expression searching within INDI.NAME.SOUR and INDI.FAMS>MARR.SOUR

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
User avatar
wulliam
Famous
Posts: 150
Joined: 03 Oct 2009 10:29
Family Historian: V7
Contact:

Expression searching within INDI.NAME.SOUR and INDI.FAMS>MARR.SOUR

Post by wulliam »

Hi,

I'm starting what is, for me, the mammoth task of converting most (all?) of my icons from being flag-based to expression-based...and I've hit my first problem.

I should say up-front that I've never used Ancestral Sources. All sources are added manually...I'm sure that'll make some of you shudder, but it's my preferred way of working...

I'm trying to interrogate INDI.NAME.SOUR>TITL, where the census details are stored.

This works provided that the 1841 Census is first in the list of sources.
=ContainsText(%INDI.NAME.SOUR>TITL%,"Census 1841",STD)

This works provided that the 1841 Census is second in the list of sources.
=ContainsText(%INDI.NAME.SOUR[2]>TITL%,"Census 1841",STD)

How do I adjust it so that it will look through all sources under INDI.NAME.SOUR>TITL?

Hoping that my question makes sense...!!
William
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Expression searching within INDI.NAME.SOUR and INDI.FAMS>MARR.SOUR

Post by tatewise »

Yes, your question makes sense, but highlights that Source Citations for Census records on the Name field are problematic.

To get this into context, are these Source Citations just to confirm the person's Name and they also exist against Census Events, OR are these the only Source Citations for Census records in the Project?
There is no problem with adding them manually as long as you have been rigorously consistent. That is where AS helps.

Unfortunately, the looping index [1+] used in Diagram Text Schemes does not work here.
(I have asked Calico Pie for it to work everywhere).

So it requires a more complex Expression that tests each instance in turn.
i.e.
=IsTrue(
ContainsText(%INDI.NAME.SOUR[1]>TITL%,"Census 1841",STD) or
ContainsText(%INDI.NAME.SOUR[2]>TITL%,"Census 1841",STD) or
ContainsText(%INDI.NAME.SOUR[3]>TITL%,"Census 1841",STD) or ... )

and so on until you are happy with the number of instances tested.
However, depending where that Expression is used, it may simply be too long for FH to save. There are limits.

BTW: On Census Events the Expression would be based on:
ContainsText(%INDI.CENS[year=1841].SOUR>TITL%,"Census 1841",STD)
or
=IsTrue(%INDI.CENS[year=1841].SOUR>_TYPE% = "Census")

See how_to:understanding_expressions|> Understanding Expressions that has examples similar to all the above.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
wulliam
Famous
Posts: 150
Joined: 03 Oct 2009 10:29
Family Historian: V7
Contact:

Re: Expression searching within INDI.NAME.SOUR

Post by wulliam »

That's really helpful Mike - thanks.
I have a source citation against the individual's name for every source relevant to them. The sources are also cited against other relevant fields, such as (estimated) d.o.b. I don't use any census events.
Anyway, there is enough space for me to check the first 16 entries, and that should be plenty!

Thanks, as ever, for your speedy help!
William
User avatar
wulliam
Famous
Posts: 150
Joined: 03 Oct 2009 10:29
Family Historian: V7
Contact:

Re: Expression searching within INDI.NAME.SOUR and INDI.FAMS>MARR.SOUR

Post by wulliam »

That's all working well now...now I'm trying to think about marriage icons from expressions.

I've read this thread Icons, Expressions Diagrams (14373) at length but am obviously missing something.

I want to achieve exactly the same effect as johnmorrisoniom (I used to do this manually with flags), and have tried the expressions he suggests, but to no avail.
I've also tried constructing this, but it doesn't work either:
=ContainsText(%CUR~FAMS>MARR[1].SOUR[1]>ABBR%="BMD Marriage",STD)

Any help gratefully appreciated!
William
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Expression searching within INDI.NAME.SOUR and INDI.FAMS>MARR.SOUR

Post by tatewise »

First let's deal with the syntax of =ContainsText(...) which is:
=ContainsText( <data item>, "<search text>", STD or EXT )
So for your example it should be:
=ContainsText(%CUR~FAMS>MARR[1].SOUR[1]>ABBR%,"BMD Marriage",STD)
Note the comma where you had an = sign.
Note that is testing the 1st Marriage Event and its 1st Source Citation Short Title.

Those syntax details are crucial and are found via Search Help for the function name such as ContainsText without spaces.

You need to explain what you mean by "exactly the same effect as johnmorrisoniom".
He says he only wants a Marriage Icon when the Marriage Source has a Media image, but that relies on having a different Source Type (i.e. "Marriage" and "Generic marriage") for the two cases of with and without a Media image.
So if you have different objectives &/or different data structures, then his expressions will not yield the same effect.
What exactly are your objectives/criteria for your Marriage Icons and what expressions have you tried?
Exactly what Source Citation data structure(s) do you employ for Marriage facts?
The more detail you can supply, the better answer we can provide.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
wulliam
Famous
Posts: 150
Joined: 03 Oct 2009 10:29
Family Historian: V7
Contact:

Re: Expression searching within INDI.NAME.SOUR and INDI.FAMS>MARR.SOUR

Post by wulliam »

Thanks Mike...that comma was a very careless error - sorry...

As for what I'd like to achieve...Alexander Mackenzie was married three times.
temp.png
temp.png (49.77 KiB) Viewed 7185 times
Marriage 1: Ann Macaulay Source: PRegisters: Marriage, 1852, Mackenzie & MacAulay
Marriage 2: Catherine Maclennan Source: BMDCertificate: Marriage, 1866, Mackenzie & Maclennan
Marriage 3: Jane Rodger Source: BMDCertificate: Marriage, 1882, Mackenzie & Roger

At the time of marriage 3, Jane Rodger was the widow of Alexander Black. Source: BMDCertificate: Marriage, 1861, Black & Rodger
temp1.png
temp1.png (10.99 KiB) Viewed 7185 times
I hope that the pairing of icons shown above is understandable (it's in an image format as I couldn't get the text to line up properly otherwise). Lower case icons indicate a parish register record, whereas upper case icons show a civil registration record.

As for the expressions I've tried, I'm afraid I haven't kept a record of them as I've gone. I've tried using IsTrue and ContainsText but don't really know what I'm doing :(

Thanks again.
William
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Expression searching within INDI.NAME.SOUR and INDI.FAMS>MARR.SOUR

Post by tatewise »

OK, I will try and give some pointers, but since you didn't give your Source Citation data structures, I'll make assumptions.

Firstly, you cannot use the %CUR~FAMS>...% shortcut as that will only reference the current Family partnership of the couple shown in the Diagram and not any earlier or later Family as Spouse (FAMS) partnerships.

johnmorrisoniom only displays an icon if his Source record has a Media image.
You make no mention of that requirement, so will assume it is not a criteria.

I assume that all relevant Source Citations use Method 1 splitter mode.

To reference each Family as Spouse partnership, Marriage event, Source Citation use:
%INDI.FAMS[n]>MARR.SOUR>...% where n is 1, 2, 3, et seq for each Family partnership instance.
This assumes the 1st Marriage event and 1st Source Citation instances are all that matters.

I assume that PRegisters and BMDCertificate are the Source Type (_TYPE) field values.
So to test for them use such as:
%INDI.FAMS[1]>MARR.SOUR>_TYPE% = "PRegisters"
%INDI.FAMS[3]>MARR.SOUR>_TYPE% = "BMDCertificate"

Putting that together gives the following examples for each of the icons:
=IsTrue( %INDI.FAMS[1]>MARR.SOUR>_TYPE% = "PRegisters" ) for icon m
=IsTrue( %INDI.FAMS[2]>MARR.SOUR>_TYPE% = "PRegisters" ) for icon m2
and so on ...
=IsTrue( %INDI.FAMS[1]>MARR.SOUR>_TYPE% = "BMDCertificate" ) for icon M
=IsTrue( %INDI.FAMS[2]>MARR.SOUR>_TYPE% = "BMDCertificate" ) for icon M2
and so on ...

If my assumption is wrong and you need to test the Short Title (ABBR) field then use:
=ContainsText( %INDI.FAMS[1]>MARR.SOUR>ABBR%, "PRegisters: Marriage", STD ) for icon m
etc...
Or similarly for full Title (TITL) field.

Regarding the difference between IsTrue and ContainsText see the Help as advised earlier.
In this context IsTrue is simply a container for an exact equality comparison.
ContainsText is a search for the "text" anywhere in the chosen field.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
wulliam
Famous
Posts: 150
Joined: 03 Oct 2009 10:29
Family Historian: V7
Contact:

Re: Expression searching within INDI.NAME.SOUR and INDI.FAMS>MARR.SOUR

Post by wulliam »

Hi Mike,
I've only been able to read your detailed reply this evening since coming in from work.
Thank you for trying to make sense of my ramblings...I have got things working properly now, with variations upon:

=ContainsText(%INDI.FAMS>MARR.SOUR>TITL%,"PRegisters Marriage",STD)

I hope that I'm not the only person to benefit from your response; thank you again for all the time you give to everyone on this forum.
William
User avatar
tatewise
Megastar
Posts: 28410
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Expression searching within INDI.NAME.SOUR and INDI.FAMS>MARR.SOUR

Post by tatewise »

No problem, glad to help.

I imagine the variations add an instance index such as INDI.FAMS[2] and use different Title text to choose between m and M icons.

To complete the picture (sic) for others, those expressions are added using Diagram > Options > Boxes > Add Condition > Expression and then the Icon chosen via the Edit Features dialogue.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
wulliam
Famous
Posts: 150
Joined: 03 Oct 2009 10:29
Family Historian: V7
Contact:

Re: Expression searching within INDI.NAME.SOUR and INDI.FAMS>MARR.SOUR

Post by wulliam »

tatewise wrote: 29 Aug 2018 15:30 ...
Unfortunately, the looping index [1+] used in Diagram Text Schemes does not work here.
(I have asked Calico Pie for it to work everywhere).

So it requires a more complex Expression that tests each instance in turn.
i.e.
=IsTrue(
ContainsText(%INDI.NAME.SOUR[1]>TITL%,"Census 1841",STD) or
ContainsText(%INDI.NAME.SOUR[2]>TITL%,"Census 1841",STD) or
ContainsText(%INDI.NAME.SOUR[3]>TITL%,"Census 1841",STD) or ... )

and so on until you are happy with the number of instances tested.
However, depending where that Expression is used, it may simply be too long for FH to save. There are limits.
...
Mike,

I've managed to develop this a little further, and have found a simple workaround to the expressions being too long.
In my text scheme I have used your suggestion to test the first 7 instances. I've then added a new text scheme item to test the next 7, and have done this 4 times and am now testing the first 28 sources. It's clunky but it's producing the output I want.

However, is there a way of finding out the greatest number of sources against a Name record? I want to be sure that my 28 tests cover everyone (filesize 9000+ individuals) with a bit to spare.

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

Re: Expression searching within INDI.NAME.SOUR and INDI.FAMS>MARR.SOUR

Post by tatewise »

Yes, that is a sneaky workaround, but it works.

To determine most number of Name citations use an Individual Query with a Rows filter like:
Add unless %INDI.NAME.SOUR[28]% is null

If that lists any, then change the index to [29] and keep going until Result Set is empty.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
wulliam
Famous
Posts: 150
Joined: 03 Oct 2009 10:29
Family Historian: V7
Contact:

Re: Expression searching within INDI.NAME.SOUR and INDI.FAMS>MARR.SOUR

Post by wulliam »

Thanks Mike - that's worked beautifully :)
William
Post Reply