Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4396 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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 ) )

Posted

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.

Posted

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.

Posted

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.

Posted
 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.

This topic is 4396 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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