Hello everyone! This is my first time not only using the website, but posting on this community so please be nice. I am confused on what the “in text ‘abc’ find the first occurrence of text ‘b’” block fits into. I am trying to fit it into a “if, then” block (in the “if” part) and it’s not working, so maybe that’s not how you do it. I am trying to get an alert to show up ONLY IF a keyword is said in a label/description. For example, if the description is “a green sign with white text” and the kay word is green, an alert will show up. But if the description is “a blue sign with white text” no alert will show up. I know that you need the block “label =/= keyword” but I am confused on how to get the app to know what the keyword is, which I think is where the block 'in text ‘abc’ find first occurrence of text ‘b’" comes in, but once again I don’t know where to put the block. Thank you so much for your help!
Welcome to Thunkable!
As for your question let’s go topic by topic.
If you hover through a block you can find notes on what the block does. In this chase the particular block you’re using it returns a number. If the value is not found you get a 0. So you can attach it to anything that takes a numeric value like a variable, conditionals, sums, etc.
How you can incorporate it in a IF statement is this way:
- First you need something to compare it, this kind of blocks are in the logic section, I chose different to 0.
Hope it helps!
Hello! I really appreciate the help, but the coding you gave me is unfortunately not working. What am I doing wrong? Here is a screenshot of my work. Please respond as quickly as possible! Much love, Jordan
Ok, first of all you don’t need the function (purple block) and the variable number that was just an example so you can see what the block does.
I copied your code and it works, I tested it on my iPhone. Make sure your device is working properly It might be an issue that you’re not refreshing it properly, the app is not up to date, there might be some permissions you have to agree to, etc.
Hello again! I followed your coding exactly and it still shows an alert no matter what the description is. I did let the app load and refresh. I am very confused. If the description is “a family smiling for the camera” it still shows an alert, even though the coding says to only allow it if it contains green. Heres another screenshot. Thank you for your help but it is still not working
Please respond as quickly as possible! My deadline is today and this is the last thing I need to do and you are the only one helping me.
It still shows an alert because you hard coded the variable to be ‘A green sign with white text’ you need to take the input from a text input or if you’re using microsoft’s image recognizer that.
For example I did the following code with a text input:
I recorded a video to show you it does work.
Thank you so much! You literally saved my project!
Cool! Glad to help! Would you mind checking the post that helped you the most as the answer to your question?