Page 1 of 1

CombineText in a query

Posted: 02 Mar 2022 20:56
by jimlad68
I am using a slightly amended column item from one of Jane's FACT queries:

Code: Select all

=Record(TextToNumber(GetLabelledText(%FACT.NOTE2%,"Connecting Ancestor FH Id:")),"I")
This works fine and displays the simple Individual Name in the column.

I have also worked this out to get the LifeDates:

Code: Select all

=LifeDates(Record(TextToNumber(GetLabelledText(%FACT.NOTE2%,"Connecting Ancestor FH Id:")),"I"),STD)
I have tried to use the CombineText, but all I get is blank.

Code: Select all

=CombineText(Record(TextToNumber(GetLabelledText(%FACT.NOTE2%,"Connecting Ancestor FH Id:")),"I"),LifeDates(Record(TextToNumber(GetLabelledText(%FACT.NOTE2%,"Connecting Ancestor FH Id:")),"I"),STD),,)
The help suggests "This function is typically used in diagram text schemes", but if I enter a simple =CombineText("a","b",,) that works fine.

Is this possible?
Is it possible to get the Name+ LifeDates without the combine?

Re: CombineText in a query

Posted: 02 Mar 2022 22:01
by tatewise
That is strange, as I copy & pasted your =CombineText(...) expression and it works fine.

The only snag is that there is no space between the name and life dates.

To insert a space use:

Code: Select all

=CombineText(Text(Text(Record(TextToNumber(GetLabelledText(%FACT.NOTE2%,"Connecting Ancestor FH Id:")),"I")) . " "),LifeDates(Record(TextToNumber(GetLabelledText(%FACT.NOTE2%,"Connecting Ancestor FH Id:")),"I"),STD),,)

Re: CombineText in a query

Posted: 02 Mar 2022 22:09
by jimlad68
Apologies, it works now!! Quite proud of myself.
The space or similar will be useful, thanks.

Re: CombineText in a query

Posted: 02 Mar 2022 22:12
by jimlad68
I was just wondering how long an expression could be, I suspect from the commas the combinetext has max of 4 combines.

Re: CombineText in a query

Posted: 03 Mar 2022 00:12
by tatewise
Over the years, many text length limits have been removed and replaced with unlimited variable-length (I think) text.
I cannot remember for certain whether that includes Query Expressions, but I think so.

The number of commas has nothing to do with how many CombineText functions can be combined.
See the FH Help page CombineText that explains the purpose of the 4 Parameters separated by the commas.
Essentially: =CombineText( <prefix>, <primary>, <suffix>, <alternative> )
Each of those parameters can themselves be any functions including CombineText(...) so you get another set of commas and so they can nested indefinitely.

BTW: FH V7 introduced the =CombineText_AB(...) function that solves the separator space problem more neatly.
e.g.
=CombineText_AB( Record(...), LifeDates(...), "1## #" )
where
Record(...) is Record(TextToNumber(GetLabelledText(%FACT.NOTE2%,"Connecting Ancestor FH Id:")),"I")
LifeDates(...) is LifeDates(Record(TextToNumber(GetLabelledText(%FACT.NOTE2%,"Connecting Ancestor FH Id:")),"I"),STD)
"1## #" defines the space separator between them but only if both exist.

Re: CombineText in a query

Posted: 03 Mar 2022 00:29
by jimlad68
Thanks for the explanation, time for experiments.