* Data expression for year

Homeless Posts from the old forum system
Locked
User avatar
RogerF
Famous
Posts: 182
Joined: 26 Apr 2009 16:32
Family Historian: V6.2
Location: Oxfordshire, England
Contact:

Data expression for year

Post by RogerF » 12 Jul 2011 09:22

In the Family Records windows, I use the expression

   FAM.MARR[1].DATE:YEAR

to show the year of the marriage. This produces a simple number:

   1850

What I'd like to see is one of:

   1850
   1850 (app)
   1850 (est)

depending on the underlying data. Possible?


ID:5217

User avatar
Jane
Site Admin
Posts: 8441
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Data expression for year

Post by Jane » 12 Jul 2011 10:30

:ABBREV shows just the month year and modifier.

User avatar
PeterR
Megastar
Posts: 1129
Joined: 10 Jul 2006 16:55
Family Historian: V7
Location: Northumberland, UK

Data expression for year

Post by PeterR » 12 Jul 2011 12:54

I think MARR.DATE:ABBREV will show the day as well as month and year.

You can, however, use the following expression to define a new  column:

Code: Select all

=Text(Text(%FAM.MARR.DATE:YEAR%) . TextIf(%FAM.MARR.DATE:XDATETYPE% = 'approx',
' (app)',TextIf(%FAM.MARR.DATE:XDATETYPE% = 'calculated',' (est)',)))
As Tatewise has pointed out previously, having to use 'calculated' in this context is certainly not documented and may be a 'feature' of v4.1.3, but it seems to do the trick.

User avatar
RogerF
Famous
Posts: 182
Joined: 26 Apr 2009 16:32
Family Historian: V6.2
Location: Oxfordshire, England
Contact:

Data expression for year

Post by RogerF » 12 Jul 2011 21:26

Many thanks, Peter.

As you say, MARR.DATE:ABBREV doesn't hack it, but the expression that you provide (with a small version-related improvement) does the job nicely. But who'd have thought XDATATYPE would have provided the answer, given that its description is: 'Gives information about the type of a date.  Use in conjunction with XDATE1 and XDATE2 for copying dates to other applications'? Maybe it's just me, but I sometimes feel that FH's 'advanced' features are somewhat under-documented (which is a shame, given the power that's lurking there...)

Locked