Brian Dunning's FileMaker Custom Functions

GetAsTemplateLiteral ( fieldName )

Return the field - whose name contains reserved characters and/or symbols - as a template literal which can be used to retrieve the field value.

  Be the first to rate this function Log in to vote

Marcus Nilsson   Marcus Nilsson - Show more from this author
Square Moon
https://www.squaremoon.se/

Share on Facebook Share on Twitter

  Sample input:
GetAsTemplateLiteral ( GetFieldName ( Table::${A + B} )
  Sample output:
Table::${A + B}

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

/**
* ==================================================================
* GetAsTemplateLiteral ( fieldName )
*
* PARAMETERS:
* @fieldName (text) Text value
* RETURNS:
* (text) The field name as a template literal
* EXAMPLE:
* "GetAsTemplateLiteral ( GetFieldName ( Table::${A + B} )" returns "Table::${A + B}" which can be used to retrieve the field value using "Evaluate ( expression )" or "GetField ( fieldName )", unlike "Table::A + B" which is returned by default.
* DEPENDENCIES:
* None
* AUTHOR:
* Marcus Nilsson, Square Moon Industries AB, marcus@squaremoon.se
* PURPOSE:
* Return the field - whose name contains reserved characters and/or symbols - as a template literal which can be used to retrieve the field value.
* NOTES:
* For more information, read the article "Using a reserved word or symbol for a field or table name" @ https://fmhelp.filemaker.com/help/18/fmp/en/index.html#page/FMP_Help%2Freserved-word-symbol-for-field-or-table.html%23ww1030956
* REVISIONS:
* 2020-06-05, Marcus Nilsson. Created.
* ==================================================================
*
*/

Replace ( fieldName ; Position ( fieldName ; "::" ; 1 ; 1 ) ; 2 ; "::${" ) & "}"

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: