How do I get a partial match when searching an array?

Get help using Construct 2

Post » Mon Feb 23, 2015 3:23 pm

Hi. I added a search box to my app and want to let users search for things in an array. The array stores some recipe data (itemname, part1, part2, part3, requiredskill...).
I tried to use "Array: For each XY Element" and "Current Value = Searchbox.Text" but this does only give results when you enter the exact names of the values.
How can I return partial results for an entry like "Knife" when the user enters "Kn" or "fe"? Do I need to use the RegEx actions or is there some other/easier way to do this?
Bl4ckSh33p-Soft - Custom Software and Indie Games
NEW: - Overwatch Companion App
B
48
S
14
G
5
Posts: 654
Reputation: 8,107

Post » Tue Feb 24, 2015 10:09 am

Hi! After trying some things I think I found a solution. There may be many ways to improve it but it works for now. :)
I added a Dictionary object to remove duplicates (full text search in array finds the word in itemname, parts, description and would show multiple buttons for the same item). If anyone knows a better/faster way to do this I would be glad to hear about it.

Maybe someone else can need this for a future project. Here is the code:
Image
Bl4ckSh33p-Soft - Custom Software and Indie Games
NEW: - Overwatch Companion App
B
48
S
14
G
5
Posts: 654
Reputation: 8,107


Return to How do I....?

Who is online

Users browsing this forum: CJacobsSA and 15 guests