Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Variable losing style on quote and evaluate

Featured Replies

Hello fellow FMP programmers!

 

When passing styled script variables I stumbled on the following effect (FileMaker Pro Advanced 12; Windows7).

Paste into DataViewer:

 

Let ( $$testStyle = "hello " & TextStyleAdd ( "world" ; Bold ) ; "" ) &

Let ( $$testCombination = "Combination: " & Evaluate( Quote( $$testStyle )) ; "" ) &

Let ( $$testEvaluate = "Evaluate: " & Evaluate( "$$testStyle" ) ; "" ) &

Let ( $$testQuote = "Quote: " & Quote ( $$testStyle ) ; "" )

 

Paste onto any layout:

 

<<$$testStyle>>
<<$$testCombination>>
<<$$testEvaluate>>
<<$$testQuote>>

 

As you can see, evaluate and quote keep the bold text style. If used in combination any style is lost.

Is this intended behavior? Any work arounds?

Thanks for any reply,

Rewolfer.

I do not know if that is intended behavior, but it's commonly known...

 

There was even a custom function: Unformat (text) that had the simple calculation: Evaluate ( Quote ( text ) )

  • Author

I wasn't aware of the custom function. Thanks for pointing that out.

 

What makes me wonder is that only the combination of evaluate and quote strips all styles. 

This behavior forces me to ditch the quote-function when working with evaluations. Sigh.

Rewolfer.

What exactly are you trying to achieve here? The Evaluate() function looks at the expression parameter as a formula. Any styling applied to a formula or any of its parts is meaningless when the formula is evaluated. IOW, "4 + 5" evaluates as 9, and "4 + 5" also evaluates as 9, not 9.

 

You have managed to set up a rather confusing example with the $$testEvaluate variable, but it doesn't change the basic principle.

  • Author

Hello comment,

I agree with you when the evaluation is purely numerical. But concatinations / texts should preserve their formatting (as they do with evaluate() and quote() so it's apparently not "meaningless").

 

The set of custom functions I use to assign script parameters handles lots of evaluations. It works perfectly (the text as such is rendered okay) but all formatting is lost because of the combination of Evaluate ( Quote ( $$anything )).

 

I guess it's the way it is. Thanks for the reply,

Rewolfer.

 all formatting is lost because of the combination of Evaluate ( Quote ( $$anything )).

 

To be precise, all formatting is lost because the Quote() function does not preserve it the way it preserves special characters. If, for example you have a text field containing:

 

  Hello "quoted" world

 

then Quote ( Textfield ) will return =

 

  "Hello "quoted" world"

 

which when evaluated, will turn into:

 

  Hello "quoted" world

 

because now the word "world" is part of a formula and the styling is meaningless. To get what you want (I think), the Quote() function would have to go one step further and return =

 

  "Hello "quoted" " & TextStyleAdd ( "world" ; bold )

 

which would then evaluate back into the original text, including styling.

 

 

 

I am still not sure what the purpose is here, but you may want to look at the GetAsCSS() and GetAsSVG() functions, that do break the text into separately styled segments - although the results are not at all easy to reuse.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.