Turning off automatic smart quotes (was Textdisplay( is driving me crazy)


#1

In Pan 6, I could do this pretty simply, and it always worked. With the new syntax for textdisplay(, Ive had to modify the expression. No matter what I do, my output says “expression contains an operand where an operator was expected” (this is the opposite of the error message I was confused about a couple of weeks ago). But no matter what I do, I get this instead of actual results.
The intent is to display the Customer’s name and address in a format that indicates account status - black and bold if current, red and bold if “frozen”, and black and italic if the account is “closed.” Black is the default color.

This is a simplified version of what I need, it merely displays the text “Frozen”, “Closed” or “OK”, in the correct format, depending on Customer Status. I put this in the Formula pane of a TextDisplayObject:

?(«Customer Status» contains “frozen”,textdisplay(rgb(65535,0,0),”Bold”,"Frozen"),
?(«Customer Status» contains “closed”,textdisplay(““,”Italic”,"Closed"),
   textdisplay(““,”Bold”,"OK")))

Can anyone spot the problem? Is my problem somewhere in the ?( syntax?This is complicated by the fact that Pan X acts flakey sometimes, during this exercise it sometimes wouldn’t object if I intentionally put the wrong number of parentheses in the formula so I can’t be sure what it’s really telling me.


#2

Replace “Bold” with 1 and replace “Italic” with 2. It seems as though textdisplay( no longer allows for text as the style parameter even though the Help file makes no mention of this.


#3

Au contraire, the Help page for that function specifically says that the text representation of the style is supported. In any case, changing those parameters in my formula made no difference in its performance or the error message for me.

Have you tried my exact (corrected) formula in a TDO? I’m curious if you get actual expected results. I’m losing faith in the current version of PanX because its environment can get seriously flaky, and I sometimes can’t tell if it’s my error or PanX’s. Also, note that the error is “expression contains an operand where an operator was expected” rather than “operator where operand…” Jim explained what the other one was trying to tell me, what is this one telling me? It doesn’t seem to be saying that I have the wrong data type as a parameter.


#4

This is not true, "bold", "italic" or combinations are definitely allowed. I just tested and verified that they work.

Here is part of Scott’s formula:

textdisplay(rgb(65535,0,0),”Bold”,"Frozen")

He wanted to display Frozen in bold red. But if you paste this into a text display object, you get an error message. Look closely at the quotes around the word Bold – you’ve used “smart” quotes, but the quote in front of Bold is a closing quote, not an opening quote. If you change this to an opening quote, the formula works. I think you probably have several more of these in your formula. I would suggest sticking to straight quotes.

Your formula would be simpler if you used the new switchmatch( function.

switchmatch(«Customer Status»,
    "*frozen*",textdisplay("FF0000","Bold","Frozen"),
    "*closed*",textdisplay("","Italic","Closed"),
    textdisplay("","Bold","OK"))

If you enable the Rich Text Option you can make it even simpler:

switchmatch(«Customer Status»,
    "*frozen*","<b><color:FF0000>Frozen",
    "*closed*","<i>Closed",
    "<b>OK")

You can read about rich text here:

And there is also a great video session that contains nearly an hour on this topic here (using rich text you can have multiple styles in a single text display object, different fonts, colors, tab stops, margins, leading, even include images in a text display object):


#5

I’m just typing characters on my keyboard, the shifted double-quote key to the left of the Return key, and have no idea how or why they get “smart” or otherwise in the process. I would correct them as you suggest if I knew how to control it. I was trying out some alternatives in TextEdit as an easier place to type out my formula, then pasting into Pan (and my message). That may be where it started, but again I have no idea how to control that (I’d love to turn smartness off entirely).

Also, it’s unclear what importance the format of some of these parameters have - does “bold” work as well as “Bold” as a parameter (i.e., does case matter)? When using empty quotes as the color, to keep the default color, is that just quote-quote or qhote-space-quote or does that matter?

I was unaware of switchmatch, that looks very useful. I’ll check it out.


#6

Yes, I’m sure that is where they came from. Panorama always disables automatic smart quotes when you type in a procedure or formula, no matter what the system setting are. So if you had typed into Panorama, this problem wouldn’t have occurred.

You can entirely disable automatic smart quotes in System Preferences.

TextEdit also has preferences for smart quotes. My recommendation would be to turn all of these off, but in any case to type formulas and procedures into Panorama. If you really want to use an external text editor program, I would suggest TextWrangler from BareBones software (it’s free).

does “bold” work as well as “Bold”

Case does not matter, so bold, Bold or BOLD will all work equally well.

When using empty quotes as the color, to keep the default color, is that just quote-quote

Yes, no space.


#7

And now that I am smarter than my quotes, it is finally working. Thank you.