« Custom functions to simplify reading the current state of modifier keys | Main | Handling exceptions »

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341d284e53ef00d83488f32153ef

Listed below are links to weblogs that reference Merge Expressions:

Comments

Ender

This looks great, Mikhail!

It's simliar to my FieldSubstitute() CF:

http://www.fmforums.com/forum/showtopic.php?tid/120434/

but yours handles mismatched brackets more gracefully, and allows for user defined styles within the text.

Frankly, I'm a bit puzzled at how it's able to preserve the style of the source tag. Is this an ability of the Replace() function?

m.edoshin

Yes; as far as I understand FileMaker 7+ preserves text styles in calculations so when you replace something and the new text doesn't have its own styles, it inherits the style of the replaced part. This is same for all functions, I think. By the way, if the new text is styled, the styles are merged and the new text attributes take precedence. For example, if in the sample above you manually format the text in the Text field to be green, this attribute won't be overridden.

Ender

Makes sense. Thanks for the explanation. And thanks for the detailed information on all these techniques!

Mark Valverde

Your solution is awsome. I don't understand the calculation but I don't have to. It works in my solution by adding the fields and custom functions you have in your example. Thanks a bunch. Mark Valverde

Lina

Hello Mikhail.

This function is wonderful - just what I needed.

I just need to have dates & numbers specially formatted, which you mention need custom functions.
I have found these great 2 relative functions:
http://www.briandunning.com/cf/1018 (number formatting)and
http://www.briandunning.com/cf/600 (date formatting)
but I am not sure how to use them with your Merge function.

I am a newbie - can you please explain?
Many thanks!

m.edoshin

Hi Lina,

You need to install all three custom functions, the Merge Expressions() and the two others you've found and then write the merge files like:

... on [[ Date Format( My Field ) ]] ; you received a check for [[ fnNumberFormat( My Invoice::Total, 2, ".", "," ) ]]...

(I've used [ and ] to imitate angle brackets, because otherwise TypePad eats them.) That is exactly as you'd write this in a calculation field, only between the brackets.

Lina

Fantastic!
It worked perfectly, that's exactly the instruction I needed.

Thank you so much Mikhail for your kind and fast response.
(and for all the other useful tips and resources you post)

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment