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
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.
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
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)