# EvalCalcInserts ( Text )

Replace "

Average rating: 3.9 (51 votes) Log in to vote

Koji Takeuchi - Show more from this author
TonicNote, Inc. https://tonic-note.com |

EvalCalcInserts ( mailbody )

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

EvalCalcInserts ( Text )

2011.07.25, Koji Takeuchi

description:

Replace "

ex.

nameFirst = "Koji"

nameLast = "Takeuchi"

EvalCalcInserts ( "Hello,

= "Hello, Koji Takeuchi."

mailbody = "Hello,

EvalCalcInserts ( mailbody )

= "Hello, Koji Takeuchi."

## Comments

unin, japan Jul 28, 2011 |
||

non recursive version. Case ( PatternCount ( Text ; "<calc>" ) = PatternCount ( Text ; "</calc>" ) ; Evaluate ( Substitute ( Quote ( Text ) ; [ "<calc>" ; "\" & Evaluate (\"" ] ; [ "</calc>" ; "\") & \"" ] ) ) ; Text ) Not same result in some case. 1. if <calc></calc> is contained in evaluated result. 2. if there is error, return '?' 3. Using variable <calc>Let($a=0;"")</calc> first:<calc>Let($a=$a+1;$a)</calc> second:<calc>Let($a=$a+1;$a)</calc> |
||

Travis Preister Nov 8, 2016 |
||

Neat function! But I also like the idea of a non-recursive version. I think this will give the same results as the original: If ( PatternCount ( Text ; "<calc>" ) = PatternCount ( Text ; "</calc>" ) ; Evaluate ( Evaluate ( Substitute ( Quote ( Quote ( Text ) ) ; [ "<calc>" ; "\\\"\" & \" & \" & Substitute ( \"If ( EvaluationError ( Evaluate ( \\\"•\\\" ) ) = 0 ; Evaluate ( \\\"•\\\" ) ; \\\"•\\\" )\" ; \"•\" ; \"" ] ; [ "</calc>" ; "\" ) & \" & \" & \"\\\"" ] ) ) ) ; Text ) // End If |
||

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