Page 1 of 1

Finding Expressions

Posted: 17 Jun 2023 16:59
by cosfordparker
I've read the material on expressions and I think I get it - anyway, I'm not as wary of queries as I was. :) But I still don't know how to find the specific expressions I need in the list.

Example: I want to modify the standard Ahnentafel query to include columns for parents' ahnentafel numbers. I found the ahnentafel expression is categorized as Relationship. I manually searched the entire list, checking each Relationship subheading. (Is there a better way?) Didn't find what I need. I tried copying the expression from elsewhere in the original query, but that just repeated the original column data.

My head hurts from banging it against the wall! Help would be so appreciated! --cosfordparker

Re: Finding Expressions

Posted: 17 Jun 2023 17:27
by tatewise
Perhaps an explanation of the structure of Expressions might help.
See FHUG > Knowledge Base > Understanding Expressions which has cross-references to their components and FH help pages.

Expressions are composed of Data References and Functions...

Data References refer to data items in your Project such as current person %INDI% or a parent such as %INDI.~FATH>% or %INDI.~MOTH>% as explained in Understanding Data References.

Functions perform operations on those data items and return a result such as Ahnentafel numbers =AhnentafelNumber(...) as explained in Understanding Functions.

=AhnentafelNumber( FileRoot(), %INDI%, 1 ) returns the closest Ahnentafel number of the current person relative to the defined File Root person.

=AhnentafelNumber( FileRoot(), %INDI.~FATH>%, 1 ) returns the closest Ahnentafel number of the current person's father relative to the defined File Root person.

The full list of Functions is in the Help > General Topics > Advanced Topics > Understanding Functions > Functions (all) and includes AhnentafelNumber and FileRoot.

If any of the above is not clear then please post again with details of what you do not understand.

Re: Finding Expressions

Posted: 24 Jun 2023 18:06
by cosfordparker
Thank you, Tatewise - lots to absorb, but very helpful. I have two issues:

1. Currently, when I need an expression, I manually search the extensive, categorized, nested list, line by line. Is there a more efficient way to find a specific expression, even when I don't know how it might be categorized?

2. I need Ahnentafel to be a universal, visible data element, like name and gender, automatically populated where appropriate. I'm unsuccessful in making that happen and suspect those are deeper coding issues than a user can accomplish. So, as a workaround, I use Custom ID as the Ahnentafel field and manually populate it. Not terribly effective, but it's something.

I'm thinking I need to learn to program before I become Find a Grave data. :lol: Thanks again for your help! -- cosfordparker

Re: Finding Expressions

Posted: 24 Jun 2023 18:16
by BillH
cosfordparker wrote:
24 Jun 2023 18:06
2. I need Ahnentafel to be a universal, visible data element, like name and gender, automatically populated where appropriate.
I haven't really followed this thread so not sure if this would be of any help.

You can add the Ahnentafel number to the caption at the top of the Poperty Box like this:

image1.jpg
image1.jpg (47.05 KiB) Viewed 806 times

Bill

Re: Finding Expressions

Posted: 24 Jun 2023 19:26
by tatewise
cosfordparker wrote:
24 Jun 2023 18:06
1. Currently, when I need an expression, I manually search the extensive, categorized, nested list, line by line. Is there a more efficient way to find a specific expression, even when I don't know how it might be categorized?
I think you are misusing the word 'expression' when you really mean 'function'.
As I tried to explain earlier, an Expression is composed of Data References and Functions.
I'm afraid the only way to discover suitable Functions is to spend some time becoming familiar with the list.
cosfordparker wrote:
24 Jun 2023 18:06
2. I need Ahnentafel to be a universal, visible data element, like name and gender, automatically populated where appropriate. I'm unsuccessful in making that happen and suspect those are deeper coding issues than a user can accomplish. So, as a workaround, I use Custom ID as the Ahnentafel field and manually populate it. Not terribly effective, but it's something.
Unfortunately, the fields in the Property Box cannot be customised with Functions as only Data References are allowed.
Vote for Wish List allow fields with qualifiers and function results on property box tabs to add that feature.
Bill has identified the one place in the Property Box that does allow Functions.
Click the Property Box cog Menu > Options... and then the Captions... button to edit the Individual Caption and insert the =Ahnentafel(...) funcion.

Re: Finding Expressions

Posted: 26 Jun 2023 15:26
by cosfordparker
Thank you, both!

Re: Finding Expressions

Posted: 27 Jun 2023 13:31
by Jane
If you use the online version of the help and go to the all functions page
https://www.family-historian.co.uk/help ... n_all.html
You can easily use CTRL-F to search for useful words.
Also the online help search tends to be more helpful that the Microsoft search built into the standard help.

Re: Finding Expressions

Posted: 28 Jun 2023 19:14
by BevSmallwood
This looks really cool. Can you copy/paste the code you used? More to the point, how do I get it to only show on direct ancestors?
BillH wrote:
24 Jun 2023 18:16
cosfordparker wrote:
24 Jun 2023 18:06
2. I need Ahnentafel to be a universal, visible data element, like name and gender, automatically populated where appropriate.
I haven't really followed this thread so not sure if this would be of any help.

You can add the Ahnentafel number to the caption at the top of the Poperty Box like this:


image1.jpg


Bill

Re: Finding Expressions

Posted: 28 Jun 2023 20:26
by BillH
The data reference I use for just the Ahnentafel number is:

Code: Select all

[Ahentafel: =AhnentafelNumber( FileRoot(), %INDI%, 1 )] 
I'm not sure how (or if) you can make it show only for direct ancestors. There may be a way by checking if the number is blank or not.

Bill

Re: Finding Expressions

Posted: 28 Jun 2023 20:56
by tatewise
Use the =CombineText(...) function:
=CombineText( "[Ahentafel: ", AhnentafelNumber( FileRoot(), %INDI%, 1 ), "]" )

That only displays the prefix "[Ahentafel: " and suffix "]" if Ahnentafel(...) provides a number.

Re: Finding Expressions

Posted: 29 Jun 2023 09:33
by Gowermick
A point to remember, this only works for your direct ancestors if you are the root individual. I.e the expression is dynamic, so If you change the root, you will get results showing for non direct ancestors.

To get round this, I listed the Ahnentafel numbers for all my direct ancestors, then copied these into a custom ID field.
The custom ID is static, and doesn’t change even if I change the root.

Re: Finding Expressions

Posted: 29 Jun 2023 10:00
by tatewise
To obtain the Ahnentafel Number relative to a specific person regardless of the File Root then use the =Record(...) function.
e.g.
AhnentafelNumber( Record( 321, "I" ), %INDI%, 1 )

where 321 is the Record Id number of the root person and "I" is the capital letter I for Individual record.