Page 1 of 1
Expression - is it possible to get son of / daughter of
Posted: 23 Nov 2016 08:24
by dewilkinson
In a sentence I am able to produce "...of John Starling Butcher and Eleanor Durrell Norman" with the expression {%CUR_PRIN.FAMC[1]>%} , but I cannot seem to find how to get son of... / daughter of ..... Is that possible?
Re: Expression - is it possible to get son of / daughter of
Posted: 23 Nov 2016 11:03
by tatewise
Use {=CombineText( Sex(%CUR_PRIN%," son"," daughter"," ?"), %CUR_PRIN.FAMC>%, "")}
This only produces text if %CUR_PRIN.FAMC>% exists, i.e. there are parents.
The 1st parameter is a prefix and the 3rd parameter is a suffix (in case blank).
The prefix Sex(%CUR_PRIN%," son"," daughter"," ?") produces text according to Sex of Individual.
That will produce son...of John Starling Butcher and Eleanor Durrell Norman etc.
But I suspect you will want to get rid of the elipsis (...)?
So you will need:
{=CombineText(Sex(%CUR_PRIN%," son of "," daughter of "," ? of "), TextIf( Exists(%CUR_PRIN.FAMC%), Text( CombineText(,%CUR_PRIN.~FATH>%,,"unknown father") . " and " . CombineText(,%CUR_PRIN.~MOTH>%,,"unknown mother")),""),"",)}
Re: Expression - is it possible to get son of / daughter of
Posted: 23 Nov 2016 13:27
by dewilkinson
Mike,
Thank you, that works a treat. My next hurdle is to do the same in a marriage sentence and pick up the spouses parents, is that possible?
Re: Expression - is it possible to get son of / daughter of
Posted: 23 Nov 2016 14:03
by tatewise
Yes, the expression is exactly the same for the husband, and for the wife simply replace each CUR_PRIN with CUR_PRIN2.
i.e. Current Principal and Current Principal 2
Keep the Sex(...) functions to cater for same sex partnerships.
Re: Expression - is it possible to get son of / daughter of
Posted: 23 Nov 2016 14:51
by dewilkinson
Mike,
I did wonder if it was as simple as that.
Thank you very much for your help, I can begin to see how expressions work now.
Re: Expression - is it possible to get son of / daughter of
Posted: 23 Nov 2016 15:36
by tatewise
Now you are getting to understand them, did you find how_to:understanding_expressions|> Understanding Expressions a useful starting point, bearing in mind its cross-references to the FH
Help on
Advanced Topics and to
Data References and
Functions?
Are there ways it could be improved?
Remember, it appears you have only been using
FH for less than a month ! ! !
At this rate you will soon be an expert.

Re: Expression - is it possible to get son of / daughter of
Posted: 23 Nov 2016 16:23
by dewilkinson
Mike,
I wouldn't quite say that, but I have many years of programming experience in many languages and in database design and management.
I did look at Expressions in the Knowledge Base and have set up a few already. I thought this more difficult expression must be possible, and had a go, but the difficulty with all things like this is understanding the protocols and syntax. I didn't think Prin2 would apply in both directions in a marriage, but it does. This tells me this expression system is incredibly powerful and seemingly little is impossible. it is just knowing how.
I really look forward to exploring this aspect further and making use of the capabilities. Coming from TMG this capability makes a huge advance.
Re: Expression - is it possible to get son of / daughter of
Posted: 29 May 2020 14:07
by tatewise