* Expressions in Custom Query
Expressions in Custom Query
I am still getting familiar with queries, and have modified a few quite successfully.
I now wish to customise the 'Ancestor' Query, so that it always runs with my 'FileRoot' as the "Starting Person" without prompting.
A lot of the columns include ["Starting Person"] in their expression. Which I understand to be a Parameter called 'Starting Person', obtained from a prompt (it is enclosed in [ ] ).
By changing this to "FileRoot", I thought it would suffice, and query would run without prompting, but whenever I tried to change it, I got following error:-
"The Expression entered is not recognised as a valid function, or some parameters were entered incorrectly"
e.g. What is correct syntax for modifying the expression "=RelationCode(["Starting Person"],,GENS_UP,1)" to use "FileRoot" instead of ["Starting Person]"?
The answer may be staring me in the face, but for the life of me I can't see what I'm doing wrong.
Any suggestions?
I now wish to customise the 'Ancestor' Query, so that it always runs with my 'FileRoot' as the "Starting Person" without prompting.
A lot of the columns include ["Starting Person"] in their expression. Which I understand to be a Parameter called 'Starting Person', obtained from a prompt (it is enclosed in [ ] ).
By changing this to "FileRoot", I thought it would suffice, and query would run without prompting, but whenever I tried to change it, I got following error:-
"The Expression entered is not recognised as a valid function, or some parameters were entered incorrectly"
e.g. What is correct syntax for modifying the expression "=RelationCode(["Starting Person"],,GENS_UP,1)" to use "FileRoot" instead of ["Starting Person]"?
The answer may be staring me in the face, but for the life of me I can't see what I'm doing wrong.
Any suggestions?
Mike Loney
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com
- tatewise
- Megastar
- Posts: 27078
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Expressions in Custom Query
Mike, checkout how_to:understanding_functions|> Understanding Functions where it explains Functions need an = sign (except when used within another Function), e.g. =RecordId(), and may have parameters withing the (parentheses).
For full details see the Family Historian Help > Using Family Historian > Advanced Topics > Understanding Functions and under Functions (all) you will find FileRoot with the example =Relationship(FileRoot()).
Whereas, ["Label"] is the format for a parameter prompt.
So within =RelationCode(...) since it is within another function, the format is FileRoot():
=RelationCode(FileRoot(),,GENS_UP,1)
I suspect you had overlooked the () parentheses needed on every Function even if it has no parameters.
For full details see the Family Historian Help > Using Family Historian > Advanced Topics > Understanding Functions and under Functions (all) you will find FileRoot with the example =Relationship(FileRoot()).
Whereas, ["Label"] is the format for a parameter prompt.
So within =RelationCode(...) since it is within another function, the format is FileRoot():
=RelationCode(FileRoot(),,GENS_UP,1)
I suspect you had overlooked the () parentheses needed on every Function even if it has no parameters.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- PeterR
- Megastar
- Posts: 1129
- Joined: 10 Jul 2006 16:55
- Family Historian: V7
- Location: Northumberland, UK
Re: Expressions in Custom Query
You can use the following two filters on the Query Rows tab (by using the General tab at the bottom):
Add if =IsAncestorOf(,FileRoot()) is true
Add if =IsSameItem(,FileRoot()) is true
Add if =IsAncestorOf(,FileRoot()) is true
Add if =IsSameItem(,FileRoot()) is true
Peter Richmond (researching Richmond, Bulman, Martin, Driscoll, Baxter, Hall, Dales, Tyrer)
Re: Expressions in Custom Query
PeterR,
I had just worked that out when I saw your reply.
I came up with a slight variation :- =IsAncestorOf(%INDI%,FileRoot())
It works!!
Thanks
I had just worked that out when I saw your reply.
I came up with a slight variation :- =IsAncestorOf(%INDI%,FileRoot())
It works!!
Thanks
Mike Loney
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com
Re: Expressions in Custom Query
Well, almost right.
The resultset didn't include FileRoot()
I got round it by creating a list call 'Root' and added individual to it.
I then used Add if =IsInList(%IND%,"Root") and that works, but surely there must be a better way?
What expression can I use in the Add if.. field? in order to include FileRoot in the ResultSet?
Any suggestions?
The resultset didn't include FileRoot()
I got round it by creating a list call 'Root' and added individual to it.
I then used Add if =IsInList(%IND%,"Root") and that works, but surely there must be a better way?
What expression can I use in the Add if.. field? in order to include FileRoot in the ResultSet?
Any suggestions?
Mike Loney
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com
Re: Expressions in Custom Query
Mike,
My reply to your suggestion I was missing the ( )'s seems to have disappeared into the ether. Sorry about that.
You're quite right, it was the missing brackets that was the problem.
Thanks
My reply to your suggestion I was missing the ( )'s seems to have disappeared into the ether. Sorry about that.
You're quite right, it was the missing brackets that was the problem.
Thanks
Mike Loney
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com
- PeterR
- Megastar
- Posts: 1129
- Joined: 10 Jul 2006 16:55
- Family Historian: V7
- Location: Northumberland, UK
Re: Expressions in Custom Query
@Gowermick – Please see my earlier reply, above, where the 2nd row filter is there to include the file root.
Peter Richmond (researching Richmond, Bulman, Martin, Driscoll, Baxter, Hall, Dales, Tyrer)
Re: Expressions in Custom Query
PeterR,
Sorry, teach me to read your reply properly.
Thanks again
Sorry, teach me to read your reply properly.
Thanks again
Mike Loney
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com
- tatewise
- Megastar
- Posts: 27078
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Expressions in Custom Query
Guys, assuming this is an Individual Query there is a slightly neater solution.
On the Rows filter tab, on its General tab enter Add if =IsSameItem(FileRoot()) is true.
Then on Relations tab, choose Add if an Ancestor of Anyone in the current result set.
By changing the General tab Expression to choose someone else, needs no change to the Relations tab to include all their Ancestors.
On the Rows filter tab, on its General tab enter Add if =IsSameItem(FileRoot()) is true.
Then on Relations tab, choose Add if an Ancestor of Anyone in the current result set.
By changing the General tab Expression to choose someone else, needs no change to the Relations tab to include all their Ancestors.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Expressions in Custom Query
Mike,
I must be learning something, I actually understood where you're coming from on your last suggestion.
Mike
I must be learning something, I actually understood where you're coming from on your last suggestion.
Mike
Mike Loney
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com
Website http://www.loney.tribalpages.com
http://www.mickloney.tribalpages.com