How to use table search?...

I like to search for a value in a table instantly. Can the following new function help me. Is there an example?...Thanks...

What is key, target rowcol, targetrowcol, start range, end range...I am kind of confused with the following syntax..

Thanks for your help.

KC

tableSearch(table,key,"[row|col]",targetRowCol,startRange,endRange,"(not)[exact|beginsWith|endsWith|contains]")

Comments

  • spidey906spidey906 Member Posts: 52

    I found a good tutorial

  • hatchhatch Member, PRO Posts: 5

    Great tutorial. can someone 'riddle me this' please. Can i use this search function to query a table for a value to create a subset (or recordset) of rows.

    e.g i search a table for ROWS matching a KEY (this table could have 50+ values that would match this)

    Can i do this?

    What i would like to do is search my table for value and then randomly select one of the results to display. Basically i have a quiz and i can categorize questions by theme and then just search by the theme key for the questions i want to ask....

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,945
    edited July 2014

    @hatch‌

    So if you had the following table:
    quiz1 Is a dog an animal? quiz1 Is a cat an animal? quiz1 Is a table an animal? quiz2 Can whales fly? quiz2 Can mice fly? quiz2 Can eagles fly? quiz3 Is California a state?

    Then you'd search for "quiz2" and have it pick one of the three rows (row 4, 5, or 6) at random and display the question?

    If so, yes, it's easy to do that. You would just use the search result for "quiz2" as the starting row number and the search result for "quiz3" minus one as the ending row number and then do something like:

    Change Attribute game.questionRow to random(game.startingRow,game.endingRow) Change Attribute game.currentQuestion to tableCellValue(tableName,game.questionRow,2)

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

Sign In or Register to comment.