Page 2 of 2
Re: Using expressions
Posted: 11 May 2015 13:48
by londonscorpion
No - nothing saved at all, so I guess I have to re-apply everything !! At least I will get more practice.
Re: Using expressions
Posted: 11 May 2015 16:59
by londonscorpion
I have just realised that an Expression will only produce a flag on a diagram IF and ONLY IF the citation referenced is the first citation in the Source Pane. Is there any way around this?
Re: Using expressions
Posted: 11 May 2015 17:02
by tatewise
It it is critical to Save Diagram As > Custom Diagram Type and similarly with Diagram Text Schemes, Reports, etc. Otherwise, an Import or click on Installation Settings can destroy everything. You can still have those settings in the default Diagrams but the Custom versions act as a backstop, and remember many settings are saved in the Windows Registry.
An alternative is to use the Backup and Restore Family Historian Settings Plugin, which preserves the Windows Registry settings as well as Custom type files.
Re: Using expressions
Posted: 11 May 2015 17:09
by tatewise
Yes, it does say that throughout how_to:understanding_expressions|> Understanding Expressions.
To reference anything other than the first instance of anything use an index as explained in how_to:understanding_data_references|> Understanding Data References.
e.g. SOUR[2] refers to 2nd instance of Source Citation.
You can either enter separate Box Condition Expressions or combine into one Box Condition by using the or operator.
However, it is good practice to put the key Source Citation first.
Also please do not confuse the terms Flag and Icon.
Flags are added to Individual Records, whereas Icons are added to Diagram Boxes.
Re: Using expressions
Posted: 11 May 2015 17:35
by londonscorpion
I have read the article and I have tried to enter the following Expression:
=ContainsText(%INDI.BAPM.SOUR[1]>_TYPE%,"Baptism Index",STD) OR ContainsText(%INDI.BAPM.SOUR[2]>_TYPE%,"Baptism Index",STD)
FH6 tells me the expression is not valid.
Re: Using expressions
Posted: 11 May 2015 17:38
by tatewise
how_to:understanding_expressions|> Understanding Expressions has an example of how to construct =IsTrue( ... or ... or ... ) expressions.
Re: Using expressions
Posted: 11 May 2015 18:13
by londonscorpion
I have tried the following and this too is not acceptable:
=IsTrue(ContainsText(%INDI.BAPM.SOUR>_TYPE%,"Baptism Index",STD) or (ContainsText(%INDI.BAPM.SOUR[2]>_TYPE%,"Baptism Index",STD) or (ContainsText(%INDI.BAPM.SOUR[3]>_TYPE%,"Baptism Index",STD))
Re: Using expressions
Posted: 11 May 2015 18:33
by tatewise
That is because you have not got your ( brackets ) nested in pairs correctly.
Look at the example more closely.
Every function must have a ( bracket tied to its name and another ) after its last parameter.
Your expression has 6 opening ( brackets and 4 closing ) brackets so they are not in matched pairs.
Re: Using expressions
Posted: 11 May 2015 18:48
by Jane
You need to check you close all brackets.
=IsTrue((ContainsText(%INDI.BAPM.SOUR>_TYPE%,"Baptism Index",STD)) or (ContainsText(%INDI.BAPM.SOUR[2]>_TYPE%,"Baptism Index",STD)) or (ContainsText(%INDI.BAPM.SOUR[3]>_TYPE%,"Baptism Index",STD)))
Re: Using expressions
Posted: 11 May 2015 19:58
by tatewise
I disagree Jane, the brackets around outside of the ContainsText( ... ) functions are redundant.
Re: Using expressions
Posted: 12 May 2015 07:44
by Jane
It's habit on my part, the development language I use for my day job requires them so I tend to put them in when doing expressions. As you said you just need to make sure you close all the ones you open. Personally I always put long expressions in PSPad first so I can use the built in bracket checking.
Re: Using expressions
Posted: 12 May 2015 10:07
by londonscorpion
Thanks for all your help. The formula is now accepted as follows:
=IsTrue(ContainsText(%INDI.BAPM.SOUR>_TYPE%,"Baptism Index",STD) or ContainsText(%INDI.BAPM.SOUR[2]>_TYPE%,"Baptism Index",STD) or ContainsText(%INDI.BAPM.SOUR[3]>_TYPE%,"Baptism Index",STD))
However, it still does not give the required result. The formula is based on example 3 in the Source Citation Fields section of the Understanding Expressions text that Mike directed me too. That Expression is "True if 1st or 2nd or 3rd Marriage Event has a Source Citation." But this does not quite match my requirement for which, I think, the expression would be described as "True if 1st or 2nd or 3rd Citation in the 1st Baptism Event has the words 'Baptism Index'."
Am I right, and if so how would such an expression be couched?
Re: Using expressions
Posted: 12 May 2015 11:13
by tatewise
It depends on which field in the
Source Citation you are trying to test.
The
Understanding Expressions gives examples for the
Source Type and
Source Title which are the most likely.
Are you trying to test the
Source Type or
Source Title or the whole
Source Record?
Have you defined an
Icon Feature for the
Condition?
Way back on
07 May we agreed that you wanted to use the
Source Type field:
- =IsTrue(%INDI.BIRT.SOUR>_TYPE% = "Birth Index")
- =IsTrue(%INDI.BIRT.SOUR>_TYPE% = "Ordered Birth Cert")
- =IsTrue(%INDI.BIRT.SOUR>_TYPE% = "Birth Certificate")
Each one will have a different
Feature Icon.
On
09 May you said "
All is now implemeted and working well."
So assuming you are using thre same strategy for
Baptisms you just replace
BIRT with
BAPM or use the
Data Ref Assistant and replace
Birth with
Baptism.
Then repeat it three times with desired index
[2] and
[3] within
=IsTrue( or ) function.
Your
Expression works OK for me providing there is
Baptism with a
Source Citation with a
Source Type containing
Baptism Index.
If you are testing the
Source Type to equal a specific value as per
07 May above, then the
=IsTrue() functions are nested and can be simplified to:
=IsTrue( ( %INDI.BAPM.SOUR>_TYPE% = "Baptism Index" ) or ( %INDI.BAPM.SOUR[2]>_TYPE% = "Baptism Index" ) or ( %INDI.BAPM.SOUR[3]>_TYPE% = "Baptism Index" ) )
But since it is a key
Baptism citation, why is it not the
1st Citation which would avoid all this complexity?
Re: Using expressions
Posted: 12 May 2015 14:33
by londonscorpion
I confirm that I am testing the Source Type (containing Baptism Index) , and that I have defined Icons for this (and all other) Expression Conditions.
On May 9th all appeared to be working well but this was because there was only one Baptism Source Citation on each record selected for the Chart. When I ran the report on other records the problem surfaced, and it turned out that (a) these records had more than one Baptism Source Citation AND (b) the Baptism Source Citation was not at the top of the list; when I moved it to the top then the Icon appeared on the Chart.
I am sure the Expression works well for you, but did you try it where the Source Citation is NOT the only Source Citation for that event and it is NOT the first one for that Source.
The complexity seems to arise because each Expression needs to work on one event (e.g a birth) for which there could be several Source Citations (e.g. a conversation with a relative, a birthday card, a death index, and a birth certificate). In this particular example the birth certificate (identified as Source Type "Birth Certificate") is fourth on the list. As it stands, the formula will not work unless I move the birth certificate citation to the top of the list.
I note your suggestion about nesting and will implement that when we find an Expression that will do the trick.
Re: Using expressions
Posted: 12 May 2015 15:31
by tatewise
The following Expressions all work for a Baptism Event with three Citations where only the 2nd or 3rd one has a Source Type = Baptism Index. As soon as I make it the 4th Citation the icon vanishes.
One thing to double check is all the other Box Condition Expressions to see if another one overrides the failing one by testing a Baptism Event for something else.
=IsTrue((%INDI.BAPM.SOUR>_TYPE% = "Baptism Index") or (%INDI.BAPM.SOUR[2]>_TYPE% = "Baptism Index") or (%INDI.BAPM.SOUR[3]>_TYPE% = "Baptism Index"))
=IsTrue(ContainsText(%INDI.BAPM.SOUR>_TYPE%,"Baptism Index",STD) or ContainsText(%INDI.BAPM.SOUR[2]>_TYPE%,"Baptism Index",STD) or ContainsText(%INDI.BAPM.SOUR[3]>_TYPE%,"Baptism Index",STD))
=IsTrue(ContainsText(%INDI.BAPM.SOUR>%,"Baptism Index",STD) or ContainsText(%INDI.BAPM.SOUR[2]>%,"Baptism Index",STD) or ContainsText(%INDI.BAPM.SOUR[3]>%,"Baptism Index",STD))
However, avoid all that complication by simply making the key Citation 1st.
I do not understand why it would not be 1st already as the primary source.
The Birth Certificate Citation must be the most significant for a Birth Event.
The Baptism Index Citation must be the most significant for a Baptism Event.
The same applies to every other Fact.
A Citation for XXX must be the most important for Fact XXX, and that is what the example expressions are testing.
Re: Using expressions
Posted: 12 May 2015 17:47
by londonscorpion
Now everything is fine. I deleted all the old expressions and did them again. I think your overide idea was correct.
I need the complexity because very often in the course of research many Citations are entered before the final 'Killer', primary evidence, Citation is found; and then in the excitement of the moment you forget to make the re-ordering adjustment. Maybe that is an option that should be added to Ancestral Sources: "Elevate Certificate to first position in the /event/ source". Maybe the real reason, though, is that I would have to troll through 5 or 6 events for over 1,200 people to make sure the all these 'primary' citations were in 1st position.
Anyway, all is now sorted and the process has been a salutory one and I have learnt a lot. Many thanks for that, Mike, and your patience.
Just for the final record here are all the expressions I have used for my strategy.
Baptism
=IsTrue((%INDI.BAPM.SOUR>_TYPE% = "Baptism Index") or (%INDI.BAPM.SOUR[2]>_TYPE% = "Baptism Index") or (%INDI.BAPM.SOUR[3]>_TYPE% = "Baptism Index"))
=IsTrue((%INDI.BAPM.SOUR>_TYPE% = "Baptism Record") or (%INDI.BAPM.SOUR[2]>_TYPE% = "Baptism Record") or (%INDI.BAPM.SOUR[3]>_TYPE% = "Baptism Record"))
Birth
=IsTrue((%INDI.BIRT.SOUR>_TYPE% = "Birth Index") or (%INDI.BIRT.SOUR[2]>_TYPE% = "Birth Index") or (%INDI.BIRT.SOUR[3]>_TYPE% = "Birth Index"))
=IsTrue((%INDI.BIRT.SOUR>_TYPE% = "Birth Certificate Ordered ") or (%INDI.BIRT.SOUR[2]>_TYPE% = "Birth Certificate Ordered") or (%INDI.BIRT.SOUR[3]>_TYPE% = "Birth Certificate Ordered "))
=IsTrue((%INDI.BIRT.SOUR>_TYPE% = "Birth Certificate") or (%INDI.BIRT.SOUR[2]>_TYPE% = "Birth Certificate") or (%INDI.BIRT.SOUR[3]>_TYPE% = "Birth Certificate"))
Marriage
=IsTrue((%CUR_FAMS>MARR.SOUR>_TYPE% = "Marriage Banns") or (%CUR_FAMS>MARR.SOUR[2]>_TYPE% = "Marriage Banns") or (%CUR_FAMS>MARR.SOUR[3]>_TYPE% = "Marriage Banns"))
=IsTrue((%CUR_FAMS>MARR.SOUR>_TYPE% = "Marriage Index") or (%CUR_FAMS>MARR.SOUR[2]>_TYPE% = "Marriage Index") or (%CUR_FAMS>MARR.SOUR[3]>_TYPE% = "Marriage Index"))
=IsTrue((%CUR_FAMS>MARR.SOUR>_TYPE% = "Marriage Certificate Ordered") or (%CUR_FAMS>MARR.SOUR[2]>_TYPE% = "Marriage Certificate Ordered ") or (%CUR_FAMS>MARR.SOUR[3]>_TYPE% = "Marriage Certificate Ordered "))
=IsTrue((%CUR_FAMS>MARR.SOUR>_TYPE% = "Marriage Certificate") or (%CUR_FAMS>MARR.SOUR[2]>_TYPE% = "Marriage Certificate") or (%CUR_FAMS>MARR.SOUR[3]>_TYPE% = "Marriage Certificate"))
Death
=IsTrue((%INDI.DEAT.SOUR>_TYPE% = "Death Index") or (%INDI.DEAT.SOUR[2]>_TYPE% = " Death Index") or (%INDI.DEAT.SOUR[3]>_TYPE% = " Death Index"))
=IsTrue((%INDI.DEAT.SOUR>_TYPE% = "Death Certificate Ordered") or (%INDI.DEAT.SOUR[2]>_TYPE% = " Death Certificate Ordered ") or (%INDI.DEAT.SOUR[3]>_TYPE% = " Death Certificate Ordered "))
=IsTrue((%INDI.DEAT.SOUR>_TYPE% = "Death Certificate") or (%INDI.DEAT.SOUR[2]>_TYPE% = " Death Certificate") or (%INDI.DEAT.SOUR[3]>_TYPE% = " Death Certificate"))
Burial
=IsTrue((%INDI.BURI.SOUR>_TYPE% = "Burial Index") or (%INDI.BURI.SOUR[2]>_TYPE% = "Burial Index") or (%INDI.BURI.SOUR[3]>_TYPE% = "Burial Index"))
=IsTrue((%INDI.BURI.SOUR>_TYPE% = "Burial Record") or (%INDI.BURI.SOUR[2]>_TYPE% = "Burial Record") or (%INDI.BURI.SOUR[3]>_TYPE% = "Burial Record"))
Re: Using expressions
Posted: 12 May 2015 18:25
by tatewise
Brilliant!
Now remember to preserve that customisation.
Use Diagram > Save Diagram As > Custom Diagram Type and if you want belt and braces, use File > Import/Export > Export > Diagram Type and the Backup and Restore Family Historian Settings Plugin and backup those files to a separate storage device.
See glossary:backup_and_recovery|> Backup and Recovery which is one of the topics in how_to:key_features_for_newcomers|> Key Features for Newcomers.
I apologise if I am repeating myself, but I assume more people read this than contribute, and failing to backup key data is a regularly recurring theme.
Just using the FH File > Backup is NOT enough for two reasons:
1) It only saves the Project related data and NOT the FH customisations.
2) It usually uses same disk as the Project, so a disk or PC crash destroys both Project and Backup.
Re: Using expressions
Posted: 13 May 2015 05:34
by arishmell
Just to update you, Mike, after your very helpful post of May 9th. I use Method 1, and most of the entries were made using Ancestral Sources. Canadian and US sources have the name of the country in the title of the citation so I have been able to use your second suggestion. UK censuses mostly do not contain the name of the country in the title, only in the place name, so your third suggestion worked here.
I have carefully worked through each census year for each country, replacing the flag with an expression, and I am very happy with the results of using expressions. However I think I shall continue to use flags in certain other cases, for example I have an icon (a white flower on a black background) to indicate death in childhood (specifically below the age of 21) and I also use a poppy icon to indicate death in wartime/military service/military action. I add these icons manually through a tickbox on a custom tab in the record box. There will always be a citation for the fact; sometimes a full source with media attached, sometimes just a note of the GRO reference number against the death event. Age at death is recorded, though sometimes this is vague. These instances are rare enough that it is easy to make a couple of extra clicks when working on the specific record, and do not need updating when new data is added.
Again, many thanks for all your efforts in helping me (and I hope others) to understand and use expressions. I have also taken note of your admonishments and carefully backed up my settings!
Re: Using expressions
Posted: 13 May 2015 08:48
by tatewise
Thank you for the update, which clearly shows you understand the pros & cons of Flags and Expressions.
As it says in how_to:using_flags_and_icons_and_expressions|> Using Flags and Icons and Expressions:
Since ƒh V4, there is no need to set a
Flag simply to add an
Icon to a
Diagram, because there are easier methods, as explained in
Using Icons below.
Flags should be used for more subtle purposes such as identifying Individuals whose family relationship is doubtful, or where further research is required, or anything else that cannot be easily derived from the
GEDCOM data itself.
I could argue that "
death in childhood below the age of 21" is easy to test with an
Expression, but it is rare, so a
Flag is a reasonable alternative.
Re: Using expressions
Posted: 13 May 2015 10:31
by johnmorrisoniom
I use a serious of expressions to display age at death related icons.
=IsTrue((AgeAt(%INDI%,%INDI.DEAT.DATE%) <= 5) and (AgeAt(%INDI%,%INDI.DEAT.DATE%) >= 1))
is the expression I use for testing for death aged 1-5
=IsTrue(AgeAt(%INDI%,%INDI.DEAT.DATE%) < 1)
is for death aged under 1.
Both of the require that at least an approximate date of birth be entered.
Re: Using expressions
Posted: 14 May 2015 05:31
by arishmell
Expressions to display age at death icons seem straightforward and I may get round to implementing them some day. I suspect that my death in war/military service icon is more complex as the only common factor is the death. There is nothing in the citation, source title or text to connect a civilian death in the London Blitz with the death of a seaman in the Crimea or a soldier in Mesopotamia. The flag serves very well for that purpose.