Table problems

darianbdarianb Member Posts: 24
edited February 2012 in Tech Support
Hi,
Am I the only person experiencing serious problems with tables?

Problem 1:
I generate a random number in an attribute I call game.correct
Then I try to display the text from a table in column 1 on row game.correct.

tableCellValue( game.tabauth , game.correct ,1)

However, this always comes up blank.
But, if I delete the command to read from the table, and just leave display text game.correct, it displays the random number.

Problem 2:
Also, much of the text contained in the table keeps vanishing from the table (as it appears in GS), although it's still present in the XML file.

The most annoying thing is, I have another app that uses the same commands and the same table, which works fine (and is already on iTunes).
Please help!

Comments

  • darianbdarianb Member Posts: 24
    No-one has any ideas? I've been playing with this for a few days, and am getting nowhere. I've tried many different options, but still the text won't show in the fields, except on the rarest occasions.
  • ChobbifaceChobbiface PRO Posts: 491
    I'm not sure if I understand you correctly, but for problem 1, if you refer to a row or column by name, it needs to be in quotes I believe...i.e. "game.correct"
  • darianbdarianb Member Posts: 24
    That's not what I meant. game.correct is a random row on a table, in this case with just 1 column. The cell (row, col) contains text, e.g. London. I use the command tableCellValue( game.tabauth , game.correct ,1) in a display text behaviour, but nothing is displayed in the actor. I've done exactly the same in another app, and it works.
  • ChobbifaceChobbiface PRO Posts: 491
    Just did a quick test with what you wrote above.

    Using tableCellValue(game.tabauth, game.correct, 1) leads to invalid expression to display in the display text behaviour.

    Using tableCellValue(game.tabauth, "game.correct", 1) displays London correctly

    That's a bit strange if it works in another app, I've uploaded the file here for you to look at http://www.mediafire.com/?q7a9nhb9sndjd3m

    See if that is what you're after
  • darianbdarianb Member Posts: 24
    edited February 2012
    Thanks for your help, your time is appreciated. game.correct is an attribute rather than the name of a row. I can't do it the way you suggest, because I've hundreds of rows (376 to be precise), so naming each isn't viable. Regardless, I striped the app down to the very minimum as you did (2 rows in each table), and everything now works. Which means that the problem is with the handling of the tables, or the way text is stored in the tables. In the full/non-working version, each cell in Col 1 has about 20 characters on average, Col 2 has about 30 chars on average, while Col 3 has between 30 chars to 700. This is the same as in the app that is already on iTunes, so I don't know what it is about this app that doesn't like it. Thanks again.
  • ChobbifaceChobbiface PRO Posts: 491
    Haha so dodgy GS behaviour. Oh well, glad you got it sorted anyway
  • MotherHooseMotherHoose Member Posts: 2,456
    the "  " denote that the game.correct is a label for a row/col … it is read as text not: the original type…integer, real, index, angle, nor boolean.

    the fact that a gameAttribute in the row,col … without the quotes … correctly retrieved cellValues in a previous app
    makes me suspect that the type of that attribute was text. … as text doesn't need quotes

    alas, we sometimes forget that text can be numbers as well as letters and punctuation
    and, that all numberValues can be manipulated by most functions
    though actual textNumbers … one, two, three only read as letters
    if you create a text attribute … you can use random(min,max); abs(x); floor(x); ceil(x) … etc. function on numbers there
    Provieded that attribute only contains numbers … no letters or punctuation other than decimal point; and - for a negativeValue

    we think of spreadsheets, tables, and arrays as working with numbers and that is what they do
    but, the values we enter into them are ascii text input from our keyboard! … we type them in.

    @};- MH
  • darianbdarianb Member Posts: 24
    I think I solved the problem. I was making some updates to the app already on iTunes, when the tables broke. My first thought was %@&;$^&, but then I fixed the problem by re-importing the CSV, and then filling all blank spaces in the tables before saving or otherwise using the tables. I have quite a few blanks when I import, because GS doesn't like non-English characters, and my tables have quite a few of these. When I manually filled (C&P from Excel) the blanks in the GS table before saving, the app was fixed when I eventually saved and tested it.
Sign In or Register to comment.