tablesearch not working
Hi folks, is it just me or is the tablesearch function not working properly (Windows version)? My code was working fine but now (and I've double checked) it no longer finds anything. I've done a log statement and it keeps reverting to 0 to see which row it found the data. I was using a formula with a changing search value so I then tried to do it manually to double check and the oddest thing happens - It found 4 values (out of hundreds -didn't check hundreds) but did not find the rest. I checked too if it was an issue of attributes and I tested both integer and text values to search for and the same thing happened. Its rather essential for me since a lot of my data is table based. It was working just fine several days ago to a week ago. Anyone having the same/similar problem? I haven't changed anything regarding formulas/code etc at all. I was just doing a run through and came across this.
Comments
Copy and paste your tableSearch expression here.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang The windows creator doesn't allow copy and paste with 3rd party programs so I've retyped it;
=tableSearch(game.Data, game.compiled search, "col", 1,1, tableRowCount(game.Data), "exact")
Make sure your game.compiled search attribute type matches the table cell type (e.g. text). Here's a working expression:
Note that tableSearch() only finds the first result so I'm not sure how you're getting 4 results unless you are using a loop...?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang Isn't that the same formula I had? Sorry I wasn't clearer. Its not in a loop and the reason I have 4 values was not that they all come up together but rather that I I found those individually manually. I replaced the attribute game.compiledsearch whichis the search term with the actual defined values. Only 4 of those values matched, the rest did not. And all columns plus combined search are text so it isn't an issue of different type of attribute
Perhaps make a sample project with just the tablesearch element in it so we can see what you're currently doing and if there's something wrong with it.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Okay, I see what you're saying. And yes, a same project would be hugely helpful in moving this solution forward.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Sure. Here is a dummy one. In that its not finding the term and just beginning from the start. It worked before so I have not clue why not know and why it allows some terms but not others.
There's still a lot going on there. Which term is it not finding? As the one is seems to be looking for - 1.42.6 - is not in the table.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Right, you've hard-coded 1.42.6 into the file you posted. What values are you intending to search for? If I try 1.1.6, for example, it finds it just fine. Since you said it worked for four values but not others, can you post a list of the values you tried?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Apologies, I sent the wrong file. That one is working and the hard code set to 1.42.6 was part of me testing. The correct file which I've attached now has the same concept but that the compiled search is different a little. rather than 1.1.6 its set according to the day as in - Day.12 but essentially the same code really. Of them Day.1- Day.7 are working fine, when I did a manual search they were located (So 7 correct, not 4.) Anything beyond that has not be found though which is odd.
Oops, here it is
I don't even see a tableSearch function in that file. Maybe I'm missing it but... when you post a project file it's helpful if you tell people which actor to look in and where in the actor's rules they can find the problem spot.
I'm out of patience but I do wish you luck.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
My sincere apologies @tatiang. It wont happen again. I would normally have left just the one actor but I wished to give some context just in case that affected anything (which it shouldn't). I'm a bit frazzled (tough couple of days) so I forgot to specify. I apologise. Thanks for your time. The actor in question is - Character Responses - Daily (the ones that show all the text). There is a note in there pinpointing exactly where the problem is. The debugger has several statement highlighting several data - the value of the compiled data and the value of the found in row (which was the result of the tablesearch). Thanks for all the help folks. @Armelline, you might recognise some of your own code (dynamically changing text boxes)