View Wishlist

Reference 498
Title User Defined Macros (or Custom Functions)
Category General
Description A recent FH Mailing List dialogue suggested that User Defined Macros for Expressions would make the exchange of complex
Data References and Functions more reliable and convenient.

This would allow 'experts' to create sophisticated expressions, or partial expressions, that others could use, without the risk of introducing basic syntax errors.

Although User Defined Macros look like Functions, they actually use simple text string substitution logic.

So for example =SpouseName() could be defined as %INDI.~SPOU[$1]>NAME[1]% where $1 represents the 1st macro parameter.

Thus:
=SpouseName(1) would become %INDI.~SPOU[1]>NAME[1]% the 1st spouse.
=SpouseName(2) would become %INDI.~SPOU[2]>NAME[1]% the 2nd spouse.
=SpouseName(3) would become %INDI.~SPOU[3]>NAME[1]% the 3rd spouse.
(If an actual $ character were needed then it would be represented by $$.)

To allow a list of spouse names with space separators it could be defined as %INDI.~SPOU[$1]>NAME[1]% . " "
With the =CombineText() function and custom separators it would be =CombineText( $2, %INDI.~SPOU[$1]>NAME[1]% )
So for example =SpouseName(3," & ") would become =CombineText( " & ", %INDI.~SPOU[3]>NAME[1]% )

Alternatively, a complete spouse name list Macro called =AllSpouseNames(&) could be defined as
=CombineText(,%INDI.~SPOU[1]>NAME[1]%,CombineText(" $1 ",%INDI.~SPOU[2]>NAME[1]%,CombineText(" $1 ",%INDI.~SPOU[3]>NAME[1]%,CombineText(" $1 ",%INDI.~SPOU[4]>NAME[1]%))))
Web Link http://www.fhug.org.uk/forum/viewtopic.php?f=46&t=6221
Votes 9
Rating 4.3
Added Thursday 26th July 2012 04:01 AM
Last Vote Tuesday 01st November 2016 08:06 PM

 

Only Signed in FHUG users can vote, please go to the Forum and sign in.

 Return to List