Search on Textbox Component

To see how you can implement a search you can learn from this sample project

https://x.thunkable.com/projectPage/600c2ce7f153060012143ac4

1 Like

Screen goes blank and shows something went wrong.

1 Like

I believe you are causing the app to crash by changing the value of the text input’s text in a loop while at the same time checking to see if the value has changed. The loop is going to change the value which is going to restart the loop which is going to change the value which is going to restart the loop which is –— crash!

If you want to assign Title Case [app variable currentRow] to something, assign it to a different label or text input.

1 Like

It’s Still crashing.

1 Like

If you don’t share your blocks then I don’t know how to help you. There could be ten different reasons why it’s crashing. I don’t even know if you made the changes I suggested.

1 Like

You have two mistakes in your block

image
The first block for list of values.... should be outside of the Changes block.

The for each loop .... should use internal variables. You are using app variable for it.

Fix these two issues and then check. They might not be the cause of the crash but they have to be fixed for the project to run smoothly.

Here’s project link. In order form screen, i want to search client name text box. I have placed data viewer list just below that text box with visibility false. And have done all blocks in change event of client textbox.

https://x.thunkable.com/copy/8531abf21429f9b05c1a6a7fdee14382

I tried changing, I have taken clientName variable to open screen event. Now, it’s not showing data viewer at all.

The problem is still the same… you need to change this:

At least to test it and know if that’s causing the problem (I think it is).

I also don’t see where you are setting the initial value of app variable currentRow. It seems like you’re checking to see if it contains the text input text but the value of app variable currentRow is null.

Edit: okay, you changed the loop variable to i. Now you need to replace app variable currentRow with i.

ClientName textbox problem solved. Can you please go through this particular block once again. I don’t know how can i explain this. but when i type two letters, if the data and two letters i type matches, it doesn’t ask me to select and automatically the text box is filled with matching data.
Even data list viewer is not being visible.

Please share a link to your updated project.

https://x.thunkable.com/copy/4da29c5a379bf5437cb91f5b1b4353f0

You have not fixed the first problem here:

You have not fixed this problem:

There’s a separate problem with your search, though.

Let’s say I have a client named Jennifer and a client named Jenny. If I type “Jen”, what do you want to appear in the Client Name field? Because they both match the search term but they can’t both be displayed.

Edit: I see your Data Viewer List (DVL) now. I would do it this way:

  1. The user types in a search term.
  2. The DVL pops up matching names – I would probably use a List Viewer instead but that’s just me… I know @muneer used a DVL in his demo.
  3. The user taps on a name in the DVL.
  4. The client name field is filled with the name that was tapped.

Right now, you’re doing 1+2 and then filling the client name field with one of the matching names without user input.

The thing is… @muneer already made you a working demo so I’m not sure how much more I can help here.

1 Like

Another thing to consider is the maximum number of expected entries. If few 10s then a dropdown list would be ideal for the task. You do not need a search box.

This demo project is based in a List Viewer and provides a replacement for a dropdown menu.
https://x.thunkable.com/projectPage/5fce83a95373b000115a9279

What I actually want is, when I type in textbox, if in data base the name exist it should show me the data viewer and let me choose that data, and if there’s no data then it should not show me data viewer at all. Plus I used data viewer because I needed one more column to confirm I used Title & Subtitle format of data viewer, so that the data I’m selecting is concerned with the same client I’m looking for.
I can’t put label at textbox because if the client is new I have to enter his/her name, and without entering I can’t store it into database. So, what i actually want is, when I type it should search

  1. if there’s a match then it should show me data viewer and let me select.
  2. if not then it should not show me data viewer.

I need code block for this. As I tried every thing, but nothing works.
Every method,every block, every changes i did. It’s not working.

1 Like

I understand what you’re needing. It might be time to hire someone to help you if that’s going to make your project get finished sooner. Otherwise, you may need to take the time to work through the demos @muneer made and watch some tutorial videos to better understand how to use Thunkable. It took me several months to get to a point where I could understand other people’s blocks well enough to modify them for my own needs.

2 Likes

Sir! Only your knowledge can get me through this. :pray:

Thank You, @tatiang for helping out. I searched and figured out that data viewer was not the best option for me out there. I did it with list viewer and it just worked. Thanks for telling me to look out for demos and tutorials, I saw and learned a lot. :heart:

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.