Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

What is the proper way to set a literal character value into a text field from a script?

I need to insert an extended character code (e.g., Wingding Up Arrow = 0233). I can enter it into a display field using "Alt+0233" from the keyboard (field defined as Font = Wingdings, of course), but I can't come up with a SetField equivalent. The help file doesn't provide anything on literals or on special characters, which seems strange.

Thanks for any help.

Posted

The difference is:

Setting the calculation value in the Set Field to 0233 produces this statement: Set Field [ YourField ; 233]

which causes YourField to display "233" instead of the Wingding Up Arrow Symbol.

Posted

"I need to insert an extended character code (e.g., Wingding Up Arrow = 0233)."

This might be a two-step process: insert the "up arrow" character; then format it as Wingdings font.

Insert the character into something (like a Word doc) using the Alt-0233 incantation, then copy the character and paste it into the Set Field calculation box in FMP.

To format it as Wingdings you'll need to use the TextFont() function and specify Wingdings. Of course, it won't appear in Wingdings on any computer that does not have the font installed.

So you might end up with:

Set Field [ field ; TextFont ( "uparrow" ; "Wingdings" ) ]

... where "uparrow" is the up-arrow character.

Having said all that, anything that relies on text formatting for display is pretty fragile. The formatting is stripped from exported text, for instance, so it's a bugger using it for anything useful.

There was a post a couple of years ago where somebody had a field with a long string of characters where a letter "a" had been formatted with Symbol font. The problem was that while it could be easily seen on-screen, it couldn't be exported or be used in any way. That was a FMP 6 database and things have changed a bit with FMP 7+, but it highlights how text formatting is a fragile way of storing information.

Posted

I don't think it's necessary to format the character to a specific font, if the field itself is formatted to display in this font on the layout. It seems the only issue here is how to type the correct character into the calculation formula. This is rather platform-specific, but typing the character into some field first, then copy/pasting it into the formula should work in any case.

Posted

Agreed the typing of the extended character is platform specific. However, Windows has a little utility that displays the characters and allows their selection and insertion using the mouse.

My bet, though, is that the character needs to be inserted into a string that is formatted with a font other than Wingdings.

Posted

How then would you type the same character code into a plain text document? I believe Alt+0233 will produce the glyph "é" in most fonts, and a field containing the plain text "é" should display an up arrow when formatted to Wingdings font. Al least that's how it works for me on a Mac with Webdings.

Posted

Thanks to you both.

It seems the only issue here is how to type the correct character into the calculation formula. This is rather platform-specific, but typing the character into some field first, then copy/pasting it into the formula should work in any case.

The solution under XP is to use the alt+0233 keyboard method to place the Up Arrow into another text field -- which doesn't have to be def'd as Wingding font -- and then cut and paste it (inside quote marks) into the set field calculation. The Wingding Up Arrow pastes in as an é character symbol -- but, when executed, the Set Field places the correct 0223 code in MyField and the Up Arrow displays. It's a little odd, but it works.

Update: It also works to type Alt+0233 directly into the calculation if bracketed with quotes (which I hadn't tried previously). An é is displayed in the Set Field statement.

Posted

How then would you type the same character code into a plain text document?

I'm not sure what you're asking. The document type should not have any bearing, except unless its a type that does not recognise the extended character (a unicode vs ascii thing).

I believe Alt+0233 will produce the glyph "é" in most fonts, and a field containing the plain text "é" should display an up arrow when formatted to Wingdings font. Al least that's how it works for me on a Mac with Webdings.

Yes, that's the expected behaviour. Whether the document is text-only or not is irrelevant, except that it cannot be formatted into Wingdings font of course.

Posted

Not to beat a dead horse, but you said:

My bet, though, is that the character needs to be inserted into a string that is formatted with a font other than Wingdings.

which I misread to mean exactly the opposite. But it shouldn't matter either way. I would expect that if the character is inserted into a string that is formatted as Wingdings, it will be inserted as an up arrow. In another font, it will be inserted as é.

IOW, you insert a code, and it's up to the string to find the glyph that corresponds to the code in the current context.

Posted

My take on the original post was that they wanted to insert a "Wingdings Uparrow" character into a field (ie, text string).

BTW we agree on everything. :

Posted

What is the proper way to set a literal character value into a text field from a script?

Although the insert character technique does work for the example I provided, it falls short of what I was striving for. If I know the literal (numeric) code of the character I want, it would be nice to be able to specifically state it in the Set Field calculation (e.g., =0233). It appears the simplest case of all is the one that isn't supported. Oh well ...

Posted

A literal is literal. A numeric code is not literal - it requires translation into a literal. Though it would be nice to have a function for that:

http://fmforums.com/forum/showpost.php?post/275464/

Posted

Such a custom function already exists...

http://www.briandunning.com/cf/285

This topic is 5863 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.