Admin»Functions

Functions

This page describes the built-in fmSpark functions that are available for using as merge values (via Insert Merge Field). For more information on the merge capabilities of fmSpark, see Merge Anything.

Functions

Today

Comment: Returns the current date
Usage: <<Today>>
Usage: <<Today-7>>
Result: 10/10/2007, 10/3/2007

TheTime

Comment: Returns the current time
Usage: <<TheTime>>
Result: 8:30:15 AM

ShortDate( DateToFormat )

Usage: <<ShortDate ( Today )>>
Usage: <<ShortDate ( CRM_TABLE::DepositDueDate )>>
Result: Oct 10, 2007

MediumDate( DateToFormat )

Usage: <<MediumDate ( Today )>>
Usage: <<MediumDate ( CRM_TABLE::ContractDueDate )>>
Result: October 10, 2007

LongDate( DateToFormat )

Usage: <<LongDate ( Today )>>
Usage: <<LongDate ( CRM_TABLE::FileCompletedDate )>>
Result: Wednesday, October 10, 2007

ShortTime( TimeToFormat)

Usage: <<ShortTime ( TheTime )>>
Usage: <<ShortTime ( CRM_TABLE::AppointmentTime )>>
Result: 8:30 AM

CurrencyFormat ( Amount ; ThousandsSeparator ; Denominator )

Usage: <<CurrencyFormat ( CRM_TABLE::AmountDue ; "," ; "$" )>>
Usage: <<CurrencyFormat ( "1999.5" ; "," ; "$" )>>
Usage: <<CurrencyFormat ( "1999.5" ; " " ; "" )>>
Result: $1,999.50, 1 999.50

FormatDateTime ( FormatString ; DateOrTimeToFormat )

Usage: <<FormatDateTime ( "the [Dth] of [month]" ; Today )>>
Result: the 10th of October
See format details below.

FormatDateTime() FormatString details

The format string uses placeholder tags to substitute different pieces of the date into the final string. The placeholder tags are the following.

  • [H] - the hour on a 24-hour clock, depending on system options (20)
  • [HH] - the hour on a 24-hour clock, depending on system options, with a leading zero (20)
  • [h] - the hour on a 12-hour clock (8)
  • [hh] - the hour on a 12-hour clock with a leading zero (08)
  • [m] - the minutes of the time (5)
  • [mm] - the minutes with a leading zero (05)
  • [am] - returns "am" or "pm" depending on time
  • [AM] - returns "AM" or "PM" depending on time
  • [s] - the seconds of the time (8)
  • [ss] - the seconds with a leading zero (08)
  • [D] - the day of month of the date (3)
  • [Dth] - the day of month with ordinal (3rd)
  • [DD] - the day of month with a leading zero (03)
  • [day] - the short day name (Wed)
  • [dayname] - the long day name (Wednesday)
  • [M] - the month number of the date (9)
  • [MM] - the month number with a leading zero (09)
  • [mon] - the short month name (Sep)
  • [month] - the long month name (September)
  • [monthname] - the long month name (September)
  • [YYYY] - the four-digit year of date (2007)
  • [YY] - the two-digit year of date (07)

Examples format strings:

  • "[dayname], the [Dth] of [month], [YYYY]"
  • "the [Dth] of [month]"
  • "[month] [D], [YYYY]" (same as MediumDate() )
  • "[dayname], [month] [D], [YYYY]" (same as LongDate() )
  • "[h]:[mm] [AM]" (same as ShortTime() )

Adding New Functions

The functions in fmSpark are implemented as Custom Functions. If you have FileMaker Advanced and create your own custom function(s), you can add it to fmSpark by visiting the Developer screen. On the "Fields and Functions" tab choose the "Functions" table and click the "New Merge Expression" button. There you can make the function (or any function for that matter - custom or plug-in) available by typing in the function syntax into fmSpark (enter the name of the function and any parameters). Just like calculations in FMP, text literals need to be quoted and other values (date, time) need to be in the proper format. We've created two custom functions, Today and Now, for the oft-used cases of inserting the current date or time.


Page URL: http://docs.proofgroup.com/fmSpark/en/1.0/Admin/Functions