* Tutorial on Queries

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.
avatar
E Wilcock
Megastar
Posts: 1181
Joined: 11 Oct 2014 07:59
Family Historian: V7
Location: London
Contact:

Re: Tutorial on Queries

Post by E Wilcock »

Mike, I have been using your Fact queries a lot.
Maybe even when I dont need to and a person query would work.
The names at the moment come sorted by forename. The column is
=GetRecord(%FACT%)

Is there any way of editing this so I can sort by surname? If necessary adding the forename in another column?
I am sorry if I have asked this before. Searching suggests that I have not.

It is not a major problem. But when working down a long list of people to see who is there, on line databases tend to order by surname.
User avatar
tatewise
Megastar
Posts: 28486
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Tutorial on Queries

Post by tatewise »

See how_to:understanding_expressions#fact_name_fields|> Understanding Expressions > Examples > Fact & Name Fields towards end where it offers two expressions that "List in Surname order with Surname first/last"

Note that for Family records that will list the name of the Husband and his Wife is not listed.
To get the wives, replace MALES_FIRST by FEMALES_FIRST in either expression.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
E Wilcock
Megastar
Posts: 1181
Joined: 11 Oct 2014 07:59
Family Historian: V7
Location: London
Contact:

Re: Tutorial on Queries

Post by E Wilcock »

Mike, to be honest, I did not understand that. About Males etc. and my attempts were rejected.

But I found another link which has fixed it
=Field(FactOwner(%FACT%,1,MALES_FIRST),'INDI.NAME:SURNAME_FIRST')

This appears to produce both males and females?
And at the same time that added column sorts the Record owner column alongside, regardless of gender.
User avatar
tatewise
Megastar
Posts: 28486
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Tutorial on Queries

Post by tatewise »

That expression is exactly what my link provides.
Yes, it lists both males and females when the Fact owner is an Individual record.

BUT if the Fact is such as Marriage then the owner is a Family record and only the husband is listed.
To list the wife needs =Field(FactOwner(%FACT%,1,FEMALES_FIRST),'INDI.NAME:SURNAME_FIRST')

Remember that when you sort on ANY column it actually sorts the whole ROW, the same as sorting in a spreadsheet.
So yes ALL the columns will move in synch with the sorted column.

Think about it. If sorting one column only sorted that column and left all the others alone, that would be a real mess!
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
E Wilcock
Megastar
Posts: 1181
Joined: 11 Oct 2014 07:59
Family Historian: V7
Location: London
Contact:

Re: Tutorial on Queries

Post by E Wilcock »

Yes of course. Thank you for explaining about the gender thing. I am a bit slow.
And of course too about the sorting. Just that I had not expected so have a sorted, clickable list of names along side the one which is not clickable. A welcome by-product.
User avatar
tatewise
Megastar
Posts: 28486
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Tutorial on Queries

Post by tatewise »

Not sure what you mean by "along side the one which is not clickable".
It is clickable and sortable, but simply that it sorts by Forename.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
E Wilcock
Megastar
Posts: 1181
Joined: 11 Oct 2014 07:59
Family Historian: V7
Location: London
Contact:

Re: Tutorial on Queries

Post by E Wilcock »

As always, Mike is correct. My choice of words not sufficiently precise. But from user point of view, one finds that the clickable list is now (indirectly) sorted by surname.
User avatar
tatewise
Megastar
Posts: 28486
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Tutorial on Queries

Post by tatewise »

I think your wording is still a little misleading.
In any Query (and other lists) ALL the column headers are clickable to sort the rows into that column order.
So if you click on new Owner column we've been discussing the rows sort into Surname order.
Click on original Record Owner column and the rows sort into Forename order, or more strictly cell text alphanumeric order.
Click on the Rec Id column and the rows sort into Record Id order.
Click on the Label column nnd the rows are sorted into Fact Label alphabetical order.
Click on the Date column and the rows are sorted into date order.
etc, etc...
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
quarlton
Famous
Posts: 166
Joined: 26 Feb 2004 13:07
Family Historian: V7
Location: Lincolnshire
Contact:

Re: Tutorial on Queries

Post by quarlton »

Hi

I've been trying to adapt the INDI.~FATH>CENS[year=" . Year(%FACT.DATE%) . "].PLAC" example to use with a parameter.

In this example: %INDI.CENS[year=1851]% the 1851 would be a parameter

What I came up with was

%INDI.CENS[year= . "Year(["Param"]) . "]"%
%INDI.CENS[year= . "Year(["Param"]) . "]%"

Both of which fail to work
Dave Simpson ~ Boulton, Braham, Carney, Simpson and Jacobs
User avatar
tatewise
Megastar
Posts: 28486
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Tutorial on Queries

Post by tatewise »

Yes, it is a bit tricky and needs the =GetField( ) function.
See https://www.family-historian.co.uk/help ... field.html
The help for that function just happens to give as an example exactly what you need:

=GetField(%INDI%,"%INDI.CENS[year=" . ["Year"] . "]%")
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
quarlton
Famous
Posts: 166
Joined: 26 Feb 2004 13:07
Family Historian: V7
Location: Lincolnshire
Contact:

Re: Tutorial on Queries

Post by quarlton »

Many thanks Mike, it worked perfectly.
Dave Simpson ~ Boulton, Braham, Carney, Simpson and Jacobs
Post Reply