How to create nutrition app with ocr scanner?

Could you just explain to me in a brief post of what I need to remove or change and then I can rewatch some other thunkable tutorials? Do I need to remove everything under the “set app variable response” and redo that whole part, or just change what checks in the “if” block?

Or could you set up a zoom meet sometime to help me? Because I need to finish this project by this weekend, but it could take a couple of days to fix the errors as well.

When would you be free to explain what I need to fix? I can do zoom too

Could you please let me know where to restart or fix so I can get this finished in a couple days? I need to finish this by friday so I can fix the errors over the weekend.

I watched a couple more tutorials and added these blocks. If this is correct should I add this for each letter grade(A, B, C, D, E)?

I forgot to put “product” in the bottom block.

I don’t have time to help you over Zoom this week. I was hoping you had a teacher who was able to offer you support.

Your “if” block checks to see if there is an error. Then, if there is an error, the “do” section of that block runs all of those other blocks. But if there is not an error, none of those blocks in the screenshot will run.

I don’t understand the positive and negative points and how they relate to the grade of A to E. So I can’t comment on whether or not what you have is correct. But if it works then, yes, you can set it up that way for each letter grade.

If the positive and negative points won’t work, then what property can I use to find the food grade?

I’m creating an app that scans a food barcode, and after reading the barcode the user will receive a food grade (A, B, C, D, E) or nutriscore. I have the barcode scanner and the web api set up, but I don’t know what properties to use to display the nutriscore of that specific food object.

This is my database:
These are the blocks I have so far:

I am trying to keep it simple by only using the carbohydrates. I followed some tutorials and this is what I have. When I try it it just says that I have an error with the blocks. Can you please help me find and fix the the error?


First of all avoid name duplicating. Even if the development platform can handle it, it is very confusing for People.

Try using a different name for carbohydrates_100g variable because the same name is used as a property in your object.

Second, use debug labels to know the output in every step of your code and to be certain that it is the intended/expected outcome.

Lastly, can you explain the else if condition you are testing? I don’t see any test unless the property is of a boolean type.

1 Like

For the else/if statements I want the amount of carbohydrates in that specific food. Then the number of carbs in each food is what I’m using to place it in a certain category (Like how healthy the food is).

Is this how you use the debug command?

1 Like

Why are you using random integer in your if conditions this will make your app unpredictable.

I advise you to read and educate yourself on the programming logic and how to construct conditions in programs.

1 Like

The carbs in each food have to be between specific numbers to be healthy/unhealthy. I couldn’t find another block that could equal the resulting number to be between two numbers.

1 Like

Whatever your reason is, it is programmatically wrong and lead to unexpected results.

I know that you want a simple fix for everything but there are a lot of problems with the way you set up your code. I can’t solve it all for you and some of this is just taking the time to learn to program. The reality of coding is that if you change one little thing, it then affects everything else. So you have fixed one or two problems from earlier but then added new problems that you didn’t have before because you moved things around or added blocks.

Some of this is basic programming like the fact that the “else if” section of a block only happens if the condition is false but the condition itself has to be a true/false statement; or realizing that a variable does not have a value until you give it a value using the “set” block. Those are things you learn over time by starting with a very simple programming task and lots of trial and error.

It seems like you’re in a hurry to get everything done by this weekend which is somewhat unfortunate because you’ve picked one of the absolute hardest features of Thunkable (Web APIs) to begin with and it’s not quick to learn. At all. But I’m a broken record at this point.

Perhaps this diagram will be helpful to point you in some directions to get the problems resolved:


Okay. Thank you for helping me out! I’ll fix those mistakes.

I had a quick question. I know I would set the variable carbs to get the json response, but what would I set for the variable “message”?

1 Like

I think @muneer’s suggestion was to use labels to display intermediate steps in your code. So instead of running the entire set of blocks and wondering why it doesn’t work, you can debug your code by adding “set label’s text to” blocks every so often and checking values that you are getting from blocks (e.g. from JSON, etc.). You can even put Wait blocks and/or Vibrate blocks in so that you know where you are in the code when something does/does not work.

This is what I tend to do in my own projects:


Is there still an error with the way this is set up? When I live test it says there is something wrong with the blocks.

1 Like

Yes, it’s still not correct. Please watch my API/JSON tutorial video to see how to set up the “get object from JSON” and “get property of object” blocks and how my if/else blocks are structured.