Tables

Hi,

I currently have a table with two columns and six rows. The App will show a random value from column 1, how do I get get my app to show the associated value from column 2, for example if the random value is the number 7 (column 1) , the associated value from column 2 would be the word Seven ?

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi @AlanGiles40

    Try this:

    Change attribute Rand to random(1,6)

    Display Text YourTable,Rand,1

    Display Text YourTable,Rand,2

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • AlanGiles40AlanGiles40 Member Posts: 2

    @gyroscope said:
    Hi @AlanGiles40

    Try this:

    Change attribute Rand to random(1,6)

    Display Text YourTable,Rand,1

    Display Text YourTable,Rand,2

    Hi. This generates a random value from column 2, I want column 2 to be the associated value based on the random value from column 1.

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited December 2015

    Hi Alan, unless I'm misunderstanding you - it's a random number, which is the same for column one and two.

    Change attribute Rand to random(1,6) - let's call this 3

    makes Display Text YourTable,3,1

    and Display Text YourTable,3,2

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited December 2015

    The associated value should be in the matching row in column two.

    So you will be looking to match rows. So the random row # you want to address should be stored in a game level variable.

    Rule

    (For example) when touch is pressed

    Change attribute game.row to random (1,7)

    Rule for column 1 display

    When game.row > 0 (this prevents an invalid expression as there is no row 0)

    Display text

    Tablecellvalue(table,game.row,1)

    Rule for column 2 display

    When game.row > 0

    Display text

    Tablecellvalue(table,game.row,2)

Sign In or Register to comment.