Current row number (or index)

I've done a search of a row successfully. How do I now
know what the row number or index is?
Thanks

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited September 2018

    The tableSearch function returns the row (or column) number where the key was found.

    So you can use that function as an expression... anywhere. For example, in a Display Text behavior, a Change Attribute behavior, a Log Debugging Statement behavior, etc.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • helpingtogrowhelpingtogrow Member, PRO Posts: 74

    HI
    I have set game.currentlabel to tablecellvalue(game.table1(tablesearch(game.table1),"0","col" , 2,1,tablerowcount(game.table1), exact",1)

    This has taken me to a cell that I want.
    Now I just need to know what the row number that cell is in.
    Thanks

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited September 2018

    Then you need to do an intermediate step to determine that. Because right now, you're feeding the result of a function to another function which effectively hides the value.

    Try this:

    Change Attribute game.foundInRow to tablesearch(game.table1,"0","col" , 2,1,tablerowcount(game.table1), exact")

    Change Attribute game.currentlabel to tablecellvalue(game.table1(game.foundInRow,1))

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • helpingtogrowhelpingtogrow Member, PRO Posts: 74

    Worked!
    Thanks so much for your time.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I deleted your last comment because it wasn't related to this thread and because you had already posted it as a new thread.

    Please don't keep re-posting it here.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.