Page 1 of 1
Wild card in query parameter
Posted: 13 Apr 2018 06:34
by dewilkinson
I am using a cloned version of the Name Search query and sometimes wish to use a wild card in the given name, i.e. to retrieve all instances of the surname. This is easy to do if you uncheck the parameter tick box and leave the value blank, but I was just wondering can you use wild cards when a parameter is checked as it is more convenient? I have tried the usual wild card characters such as * and it doesn't seem to work.
Re: Wild card in query parameter
Posted: 13 Apr 2018 10:04
by tatewise
No David, unfortunately
Queries do not support any general form of wildcard pattern matching.
However, you could modify the
Given Name filter
Expression to such as:
=IsTrue( (Text(["First Name"]) = "*") or ContainsText(%INDI.NAME:GIVEN_ALL%,Text(["First Name"]),STD) )
which would let the asterisk (
*)
Parameter value match any
Given Name.
Otherwise, you would need to use a
Plugin to perform general wildcard searching.
The
Search and Replace Plugin has a
Search Only mode, supports wildcard
Lua Pattern matching, can focus on just
Individual record
Names, and produces a
Result Set of all matching records.
You need to include the slash
/ separators around
/Surnames/ to differentiate from
Given names.
However, it does not include the
Husband name search like the
Query does.
This is one of those cases where it would be useful to invoke a fragment of
Plugin script from within an
Expression.
Then the
Query Rows filter
Expression could invoke a wildcard
Lua Pattern as supplied by the
Parameter.
See
Wish List Ref 547 Run Plugins via Expressions.
Re: Wild card in query parameter
Posted: 13 Apr 2018 13:13
by dewilkinson
Mike,
Many thanks for the helpful reply, I was coming to the conclusion that wild cards are not allowed in query parameters.
Re: Wild card in query parameter
Posted: 13 Apr 2018 13:45
by tatewise
On closer investigation the Given Name filter Expression that I suggested does NOT work quite as expected.
Unfortunately, the ContainsText(...) function ignores the :GIVEN_ALL qualifier.
So the First Name parameter value will match anywhere in the NAME field.
I have tried several variations on that theme without success.
The ContainsText(...) function simply works differently to the Query filter Operator for contains.
Re: Wild card in query parameter
Posted: 13 Apr 2018 16:39
by dewilkinson
Mike,
Thank you very much for your effort and thoughts, much appreciated. The simplest solution for me is not to use a parameter and just leave the value field blank in the query window for the GIVEN NAME and use contains for part of a SURNAME when I want to retrieve all instances of that SURNAME.