* More query 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.
Post Reply
User avatar
ColeValleyGirl
Megastar
Posts: 5464
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

More query queries

Post by ColeValleyGirl »

This is a follow-up to viewtopic.php?f=32&t=17011# (Query on a parameter that can be present or not).

I'm now able to construct a query with optional parameters when the parameter value is text.

Ideally, I want also to include the capability to restrict results to items linked to a particular source or repository (assume the first source for the purposes of this question).

However, I can't work out how to do it (and it may not even be possible).

If I prompt for a Source, there is no option to specify no source -- fh complains about a missing parameter.

I can ask the user to specify whether they want to filter on a source, but this doesn't get me much further forward -- I still have to prompt for a source (whether or not the user wants one) and then disregard the result if the user doesn't want to filter, which is not an optimum user experience.

As a fallback, I can construct 3 queries in my plugin ('simple', 'simple' plus filter on source, 'simple' plus filter on repository) but I wonder if I'm missing a trick?
User avatar
tatewise
Megastar
Posts: 28333
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: More query queries

Post by tatewise »

Think about matching text fields in the Source or Repository rather than selecting the record.
i.e. the SOUR.TITL or SOUR.ABBR or REPO.NAME fields.
Then the user can enter the text to match or * wildcard as before.

The Query filter will use %...SOUR[1]>TITL% or %...SOUR[1]>ABBR% or %...SOUR[1]>REPO>NAME% as fields to match.

As I am sure you know, that is so much easier in a Plugin.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
ColeValleyGirl
Megastar
Posts: 5464
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: More query queries

Post by ColeValleyGirl »

Yes, that sort of fuzzy matching might be the best I can achieve in the query right now. Eventually there will be an option to 'query' via the plugin, but I want to get a version out there for beta testing and I'm up against other deadlines, so that bit of code might have to wait.

15 stories to do detailed critiques of before the writing weekend I'm running in early September; and a long-postponed 3-day visit to the National Library of Wales in October for which I need to do a metric tonne of preparation, especially as I now realise it's a Family Search affiliate library, so I don't need to confine myself to Welsh searches, although those will take priority.

Why ever did I think that retirement would allow me to slow down?

While we're on the subject of Queries, Ideally I would also be able to query for Individuals with Attributes that meet a filtered set of requirements (as input to a report). And ditto for Individuals linked to Shared Notes... blah blah blah filtered. I'm pretty sure I'll have to do both those in the the Plugin unless somebody tells me differently.
User avatar
tatewise
Megastar
Posts: 28333
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: More query queries

Post by tatewise »

If your Attribute filter is against its text value then that should be possible if the umber of instances is tiny.
I assume it is an Individual type Query, so you need a Row for each Attribute and each possible instance.

Similarly, if the Shared Note filter is against its text content, and only at Individual record level and few instances, then the Query only needs one Row per instance.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
ColeValleyGirl
Megastar
Posts: 5464
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: More query queries

Post by ColeValleyGirl »

I'm experimenting with including the identity of an individual within a shared note, something like:

Code: Select all

Individual: 3
Susan Isabel Dowling
and then using the =Record() function to display the record associated with the individual in a query.

=Record(3, "I") as the expression for a column (hard-coded number) works.

=GetLabelledText(%NOTE.TEXT%,"Individual: ") returns the correct recordID

=Record(GetLabelledText(%NOTE.TEXT%,),"I") does not return the record -- I assume because the ID is returned as text, not a number?

=Record(Number(GetLabelledText(%NOTE.TEXT%,"Individual: ")),"I") doesn't work either.

Is what I'm attempting possible?
User avatar
Jane
Site Admin
Posts: 8507
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: More query queries

Post by Jane »

=Record(TextToNumber(GetLabelledText(%FACT.NOTE2%,"Shared Couple:")),"F")
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
User avatar
ColeValleyGirl
Megastar
Posts: 5464
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: More query queries

Post by ColeValleyGirl »

Thanks Jane -- I hadn't scanned right to the end of end of the function list, obviously.
User avatar
Jane
Site Admin
Posts: 8507
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: More query queries

Post by Jane »

Not a problem, I knew I had done it on the GedMatch Query
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
Post Reply