*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
E Wilcock
Megastar
Posts: 544
Joined: 11 Oct 2014 07:59
Family Historian: V6.1
Location: London
Contact:

Tutorial on Queries

Postby E Wilcock » 08 Feb 2018 20:57

I am not accustomed to learning computer skills the proper way.

And thought I would post here my experience of the tutorials.
This is Chapter 17 , Introduction to Queries - page 187 in the Book and I have got into difficulties straight away.
The instructions are to select Janet Record (a person in the sample project) then to open the query by going to the View menu select standard query and then select the query to find relations and nearest relations.
There is then a description of the of the Query Parametres dialogue box which opens up and one is asked to OK it.

Fine, except I usually approach the Query by clicking the Query icon and going from there. And indeed on page 188 this is suggested as an alternative entry to the query.

The problem is that, if one does enter by that route, one gets the general screen, but there isnt a button to OK. Or at least I couldnt see one.
So I was mystified but went back and entered via the View menu - and there it was.

I will pursue this tutorial tomorrow but I plan to skip to Chapter 18 on writing queries.

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

Re: Tutorial on Queries

Postby tatewise » 08 Feb 2018 22:06

Yes, with tutorials, if you go off piste, and don't follow the instructions exactly, then the effects will often be different.

You can get there via the Query Window button, but it takes rather longer.

By default the Query Window button opens the first Query alphabetically from the list of available Queries.
So from the Query drop-list near the top you must select Relations and Nearest Relationships from the list.
Then use the blue + triangle Run Query button to the right and obtain the prompt.
You will probably have to use the Starting Person drop-list and select or Browse to Janet Record.
Finally you can click OK.

Going via the View > Standard Queries is quicker, because the list is shorter without Custom Queries, the Run Query is automatic, and the prompt is automatically filled with the pre-selected record, so you just have to click OK.
Mike Tate ~ researching the Tate and Scott family history.

E Wilcock
Megastar
Posts: 544
Joined: 11 Oct 2014 07:59
Family Historian: V6.1
Location: London
Contact:

Re: Tutorial on Queries

Postby E Wilcock » 09 Feb 2018 07:45

Yes Mike -
I diverted this morning to watch Jane's video on creating queries. I have watched it before more than once and it is worth mentioning here.

However my usual reaction to looking down the list of Standard Queries and Downloads for custom queries is that they dont start with what most database users would think of as their most usual query. It is said that people who come to fh from other software find it hardest. But we also need to recognise that one gains knowledge in an incremental fashion, adding to what one already knows. People learn to search and filter Access and other databases. And if they dont know how to do it, there is usually someone else around who does. And the output columns are often set up too.

The bog standard query for me in any genealogy software is to find all individuals with a certain value in an Event (or Attribute).
And then to find people for whom a certain event is present within a specified date range.

For me, any section on Queries in the User Knowledge base ought to start by providing those two queries. They may be there already. But I have turned to the Query downloads countless times while using fh and they are not obvious to me.

And the problem with Jane's excellent video is that I would like to be able to refer back to it (to remind myself) with the sound track as text. I am about to watch it again and write down.
I am also going to do the tutorials in Chapter 18.

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

Re: Tutorial on Queries

Postby tatewise » 09 Feb 2018 11:34

Thank you that feedback Evelyn.
The focus on Facts (Event or Attribute) is what lead to the Fact Query type being introduced in FH V4.
There are Standard Queries such as All Facts and All Events but without any filtering.
There is the Standard Query called Contains Text but its Result Set is not very useful.

As far as I can recall you are the first to suggest those two 'bog standard' queries.

They could be easily created from an All Facts query with one of the following Rows filters, then added to the Downloads, and mentioned in the Knowledge Base on queries.

Add if =ContainsText(%FACT%,["Find Text"],STD) is true

Exclude if %FACT.DATE% is null
Exclude if %FACT.DATE% was earlier than ["Earliest Date"]
Exclude if %FACT.DATE% was later than ["Latest Date"]

Some extra Columns may also be needed for say Address and Note fields.

There is also the Edit > Find command, and the Search and Replace Plugin in Search ONLY mode.
Mike Tate ~ researching the Tate and Scott family history.

E Wilcock
Megastar
Posts: 544
Joined: 11 Oct 2014 07:59
Family Historian: V6.1
Location: London
Contact:

Re: Tutorial on Queries

Postby E Wilcock » 09 Feb 2018 14:59

Mike -To my shame, I discover that some time ago, I was provided with answers for both these and carefully pasted them into my Word doc guide to using fh.

However I am now starting Getting the Best Chapter 18 tutorials. The problem with books written by the authors of programs is that readers dont understand the meaning. I often skip the bits I dont understand, both in the book and on the forum but not today. An individual query produces a results set of individual records in a specified order -

"The Fact query produces a result set consisting of fields - specifically Fact fields" (p197)

I dont understand how fh users are meant to apply this knowledge - because for me that rules out using it for my query about relative emigration dates. Yet yesterday you designed a facts query for me, and the resulting list was of Individuals.

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

Re: Tutorial on Queries

Postby tatewise » 09 Feb 2018 15:35

The explanation in the tutorial is perhaps an over simplification to avoid confusing newcomers too much.

Yes, an Individual Query focusses on Individual Records but the Columns and Rows can refer to any items including other records that are linked to an Individual Record. So can include, each in different Column, linked Source or Media records, or child or parent or grandparent or grandchild Individual records.
BUT each Row in the Result Set is keyed to just one unique Individual Record and that record is only represented on one Row.

Similarly, a Fact Query focusses on Facts but the Columns and Rows can refer to any items including records associated with a Fact. So can include, each in different Column, the Individual or Family record that owns the Fact, or any Source records cited by the Fact.
BUT each Row in the Result Set is keyed to just one unique Fact and that Fact is only represented on one Row.

Now let us examine some of the differences.

With an Individual Query each Row refers to one unique Individual Record. So to show Facts in the Result Set will require a Column for every field of each and every type of Fact plus each and every instance of multiple Facts such as Census. That could run to dozens if not hundreds or thousands of Columns.

With a Fact Query each Row refers to one Fact. So its fields such as Date, Place & Address only need a few Columns. Its owner record, which could be an Individual or a Family record, can occupy a Column. BUT the same Individual Record can appear on many Rows, once for each Fact that it owns. Similarly, any Source or Media record linked to a Fact could appear on many Rows.
Mike Tate ~ researching the Tate and Scott family history.

E Wilcock
Megastar
Posts: 544
Joined: 11 Oct 2014 07:59
Family Historian: V6.1
Location: London
Contact:

Re: Tutorial on Queries

Postby E Wilcock » 09 Feb 2018 15:43

Ah! Now I understand. You just switched a light on for me. Thank you.

I am also on the way to understanding my previous confusion and doubts - that when one wants info about a persons Father, one has to refer back to the family where that person appears as a child and in the query Expression the Father is labelled Husband. This is so counter-intuitive.

E Wilcock
Megastar
Posts: 544
Joined: 11 Oct 2014 07:59
Family Historian: V6.1
Location: London
Contact:

Re: Tutorial on Queries

Postby E Wilcock » 09 Feb 2018 16:06

I have not understood columns before and concentrated only on rows, filtering the info I needed.
It took me time to understand that for Columns one must use the left hand column, and understand the successive indents - but I have managed to add the mother's birth date to the Tutorial list of people whose parents are called James and Catherine.

One more tutorial to go.

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

Re: Tutorial on Queries

Postby tatewise » 09 Feb 2018 16:34

Because they are needed so often, FH has shortcuts for Father, Mother, Child & Spouse.
In an Individual Query on the Columns tab checkout the Fields on the left.
There you will see those shortcuts with a black arrow icon on their left for all those relatives.
Not only that, but when you expand Family as Child there are options for Father> & Mother> rather than Husband & Wife.

So the following longhand and shortcut data references are equivalent:
%INDI.FAMC[1]>HUSB[1]>% equals %INDI.~FATH[1]>%
%INDI.FAMC[1]>WIFE[1]>% equals %INDI.~MOTH[1]>%
%INDI.FAMC[1]>CHIL[1]>% equals %INDI.~CHIL[1]>%

See Knowledge Base > Shortcuts within Knowledge Base > Understanding Data References.
Mike Tate ~ researching the Tate and Scott family history.

E Wilcock
Megastar
Posts: 544
Joined: 11 Oct 2014 07:59
Family Historian: V6.1
Location: London
Contact:

Re: Tutorial on Queries

Postby E Wilcock » 10 Feb 2018 12:44

Thank you - I saw the short cut arrows but that wasnt clear.

%INDI.FAMC[1]>HUSB[1]>% equals %INDI.~FATH[1]>%

I have finished the tutorial and wonder whether you might like to test my skills (and those of anyone else who educates themselves via this thread) by setting me/us a query to work out and create all on our own.

I realise one may not need to know this, but I do feel cowed when I read the symbols I dont understand. So I am going to return to the other thread and ask you about something there.

There is no hurry for any replies.

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

Re: Tutorial on Queries

Postby tatewise » 10 Feb 2018 15:12

I have created some 'bog standard' fact queries along the lines mentioned earlier.
They are in Downloads Knowledge Base > Query ~ All Facts Filter by Date, Label, or Text.

BTW: That won't appear in Knowledge Base > Downloads and Links ~ Query Type: Fact until the KB index gets rebuilt, but it will appear in Knowledge Base > Recently Added Downloads and Links for a while.

Firstly, please confirm they perform as you would have expected.

Secondly, as a challenge, try combining the Rows expressions together to provide say a Date & Label filter, or a Text & Label filter, or even a Date & Text & Label filter.

Additionally, try adding Columns for such as Sort Date, the place Lat/Longitude, or some Source Citation fields, and change the default sort order.
Mike Tate ~ researching the Tate and Scott family history.

E Wilcock
Megastar
Posts: 544
Joined: 11 Oct 2014 07:59
Family Historian: V6.1
Location: London
Contact:

Re: Tutorial on Queries

Postby E Wilcock » 10 Feb 2018 15:55

Thank you Mike. I down loaded them.
I did not expect you to provide them. So I Apologise that I did not phrase it well.
When I wrote "to find all individuals with a certain value in an Event (or Attribute)." I meant in a specific event. So I need to add a line to your query Fact filter by label. May be using what you did for finding the text
exclude unless =ContainsText(%FACT%,["Find Text"],STD).

Please dont reply to this I am off to do it. And have done it now.
Moreover I see that if one opts for parameters in two different lines one gets two blank fields to insert the terms.

I dont think I wished for a text search as I use the Find binoculars but it is useful to have just a list of people - I used to have to weed out the other results.

The date works beautifully too. I put in a census day month and year (twice) and got the list.
I will now look at your home work task (or was that it)

E Wilcock
Megastar
Posts: 544
Joined: 11 Oct 2014 07:59
Family Historian: V6.1
Location: London
Contact:

Re: Tutorial on Queries

Postby E Wilcock » 12 Feb 2018 13:49

Sorry Mike - I need to come back on this.
You have kindly written me three or four Fact queries.

Must each Fact query deal with only one Fact type?

So if you list for me (as you did in two lines) anyone whose parents Emigrated,
I can include and exclude the Indivs who also Emigrated. But I cant then exclude them if they (the child) experienced some other event? Or indeed if they died before a previous date?

I am failing to write such queries (adapted from your own) and I think this may be why.

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

Re: Tutorial on Queries

Postby tatewise » 12 Feb 2018 15:45

You are referring back to the writing queries (15673) thread.
And ask "Must each Fact query deal with only one Fact type?" NO.

The Query in the other thread actually works the other way round.
It filters by Exclude unless =FactLabel(%FACT%) matches Emigration so only people who emigrated are included.
But is further filtered to only include them if their parents also emigrated to a certain place.
So anything associated with the owner of an Emigration fact can be interrogated.

The expression that references the owner Individual record (the child) and associated sub-fields is:
=Field(GetRecord(%FACT%),'INDI.<etc>') where <etc> identifies the sub-field
or
=FieldText(GetRecord(%FACT%),'INDI.<etc>') if you want the sub-field text value.

So to reference any other type of fact use:
=Field(GetRecord(%FACT%),'INDI.<tag>') where <tag> is the GEDCOM tag for that other fact.
e.g.
=Field(GetRecord(%FACT%),'INDI.BIRT') for Birth Event.
or
=Field(GetRecord(%FACT%),'INDI.DEAT.DATE') for Death Event Date.
Mike Tate ~ researching the Tate and Scott family history.

E Wilcock
Megastar
Posts: 544
Joined: 11 Oct 2014 07:59
Family Historian: V6.1
Location: London
Contact:

Re: Tutorial on Queries

Postby E Wilcock » 12 Feb 2018 17:55

Thank you Mike. I need to look at this carefully. And due to half term there may be a delay. Just want you to know I appreciate your reply and the tuition.

E Wilcock
Megastar
Posts: 544
Joined: 11 Oct 2014 07:59
Family Historian: V6.1
Location: London
Contact:

Re: Tutorial on Queries

Postby E Wilcock » 14 Feb 2018 08:42

Have not yet studied this - but still at a basic level, further questions.

Is it possible to open two queries at once so one can copy and paste lines from one to another?

And a question about instances of e.g. census. Does a fact query cover all instances of the fact one is looking for?

User avatar
davidm_uk
Megastar
Posts: 683
Joined: 20 Mar 2004 12:33
Family Historian: V6.2
Location: St Albans, Hertfordshire, UK

Re: Tutorial on Queries

Postby davidm_uk » 14 Feb 2018 09:41

I don't think that you can open two queries at once within one instance of FH, but you can open a second instance of FH (even on the same project), and open a different query in each. Then you can copy and paste expressions from one to the other.

BUT - BE CAREFUL if you open the same project twice, as they will both be opening the same GED file, and confusion (maybe even corruption) could arise if both try to update the GED file. May be better to open the second instance of FH on the Sample project, or another "test" project (which could be a temporary copy of your main project - just make sure to give it a name that reminds you which is which).
FH6.2.6 on Win10 Pro

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

Re: Tutorial on Queries

Postby tatewise » 14 Feb 2018 10:57

"Is it possible to open two queries at once so one can copy and paste lines from one to another?"
YES
But first set Tools > Preferences > Workspaces > Query Window for Re-use of Open Windows Permitted to No.
Then you can open multiple copies of the Query Window. (The same applies to most Workspace Windows.)
Use Window > Cascade so both are visible at the same time.

"Does a fact query cover all instances of the fact one is looking for?"
YES
Mike Tate ~ researching the Tate and Scott family history.

E Wilcock
Megastar
Posts: 544
Joined: 11 Oct 2014 07:59
Family Historian: V6.1
Location: London
Contact:

Re: Tutorial on Queries

Postby E Wilcock » 18 Feb 2018 18:42

This is not another problem Mike.
But a heartfelt thank you.
Your "bog standard" queries (plus one I adapted to recover any event by the year it happened) enabled me to fish out some distant people from my family tree whom I want to write about - I last looked at them in 2007, had forgotten almost everything about them and feared they were lost for ever.
You have really saved me today.


Return to “General Usage”

Who is online

Users browsing this forum: No registered users and 9 guests