Opt + Space in expression editor.

xwrbnxxwrbnx Member Posts: 23

Hi all,

I am using GS in Mac.
I know we can use Opt + Space to insert a space in the expression editor.
However, it is apparently not as same as normal space.

Example:
I have a table with the row name "Level 1" and column name "Character Name". When I created the table, the space is typed as per normal (just space, not Opt + space).
When I use tableCellValue(tblCharacter,"Level 1","Character Name") of which the space is inserted using Opt + Space, it does not returned the value. Because Level+space+1 is not same as Level+OptSpace+1.
I have to change the space in row name to Opt+Space to make this work.

My question: Is there a way we can use just normal space in expression editor (avoid Opt+Space)?
Otherwise, I may have to change all the space in my tables into Opt+Space, and if I missed some, my expression may not work properly. Not sure if it is also the case for cell value, which I use a lot of space for naming, description, etc. And also, typing just normal space is easier than Opt+Space.

Thank you.

Best Answers

  • jamie_cjamie_c ImagineLabs.rocks Posts: 5,772
    edited June 2015 Accepted Answer

    The escape code \32 also works as a space in the expression editor, maybe that would do it for you.

    You know you can also indicate columns and rows by their number right, not just their names? So if the row of your table that is named "Level 1" and its column 3, you could use the number 3 in the expression instead of the name.

    Update: I tested using the \32 escape code for space in the expression editor and it works as expected, see attached file.

  • ArmellineArmelline Posts: 5,369
    Accepted Answer

    This is an interesting one.

    What's happening, from what I can tell, is that you simply can't enter the space character into the expression editor. Using alt-Space isn't actually putting a space in, it's putting in a no-break space. As these are not the same character (as you noted) it's returning false for any comparison between them.

    You can work around this in one of three ways. One is to replace the spaces in the table with alt-spaces, but I agree that this is not at all ideal.

    The second is to make use of either a few attributes, or another table. This is still more longwinded, but ultimately more flexible. See the attached project for an example.

    Another option is to avoid putting a space in by hand. This is perhaps the easiest option. Make a game (or self) attribute and call it something like "Space". Make sure it's a Text attribute. In that attribute just type a space. You can then do the references you want by saying

    tableCellValue(tblCharacter,"Level"..game.Space.."1","Character"..game.Space.."Name")

    It's an annoying issue, I completely agree there.

Answers

  • xwrbnxxwrbnx Member Posts: 23

    A bit longwinded but thanks for the suggestions :-)

Sign In or Register to comment.