Page 1 of 1

custom query with tree root name in every record

Posted: 28 Aug 2018 14:19
by piotao
Hi,
I've created a modified 'Descendants' custom query with few additional fields. All is working fine and dandy, and for a specific individual from the tree I can easily create a list of all his/her descendants, with spouses. This is superb OK.

Now, I want to include the name of specified individual (for whom is the descendants tree created), in every record, in a field called 'from'. How to do this? I know that this information will repeat in evey line, but that is desired. All data will be further exported and processed, and this 'root' field is necessary. Any hint, please?

Re: custom query with tree root name in every record

Posted: 28 Aug 2018 14:53
by tatewise
Welcome to the FHUG.

I assume you still use the prompt for Starting Person.
So set the Expression to =Individual(["Starting Person"])
or to =GetField(Individual(["Starting Person"]),"%INDI.NAME%") to explicitly show name.

Re: custom query with tree root name in every record

Posted: 28 Aug 2018 19:12
by piotao
Hey! Thank you for the quick answer. Indeed, it works! Awesome.

However, I've changed this function to my needs, using the formula:

=ToLower(GetField(Individual(["Starting Person"]),"%INDI.NAME:FIRST%"))

Simply, only firstname in lowercase is needed. However, the full name (firstname and surname) appeared in the whole column. Hmmm, maybe I can cut the text out using first space as a delimiter? However, maybe there is some simpler method, but my idea of putting NAME:FIRST seemingly is not working. Could you be so nice and drop me some clues?

Re: custom query with tree root name in every record

Posted: 28 Aug 2018 20:55
by tatewise
Yes, the following expression will do that:
=ToLower(FieldText(Individual(["Starting Person"]),'INDI.NAME:FIRST'))

There is a series of functions Field(...) and FieldText(...) and GetField(...) and GetFieldText(...) that each have slightly different capabilities, but the more complex ones take longer to execute, so could slow down a very large Query.
It is a matter of choosing the best one for the task required.

Re: custom query with tree root name in every record

Posted: 28 Aug 2018 22:38
by piotao
Thank you, I'll look for those functions. Right now my problem was solved, I'm very happy!