Is bigger than not working

I’m making an app which includes badges. There are 3 variable lists, UNLOCKED BADGES, NAMES OF THE BADGES, and CALORIES REQUIRED. Related data is kept at the same list-item-number. That means that The WATERCRESS badge is not earned(false), and requires 50 calories. Likewise, the Fitness badge is also not earned, and requires 100 calories.


Now, these are app variables, so they are reset every session. That’s why all the UNLOCKED BADGES are false. I keep track of the user’s calories in a DVL-connected table, and I want to compare each calorie number to the required number of calories and and then assign true to each badge depending on if the calorie numbers meets the criteria.
All the buttons are disabled, and I want to make each unlocked badge enabled and also show an unlocked image at the bottom. But when I test my app, I get the TEMPTATION badge(which is correct), and the WATERCRESS badge which is worth 50 calories, which isn’t correct(that means that so far none of my calorie numbers have been equal to/less than 50). I’ve looked over my code a lot of times, but I don’t see anything that’s causing the enabling of the WATERCRESS badge.
Here’s my screen:
image

And my code:

(this is put in a when screen opens block)
and the rest:

The naming is all correct. The names of each badge-button is

  • Watercress badge
  • Fitness badge
  • Healthy badge
  • Temptation badge.
    Since these are my badge names

    that is correct, as well as the images. The other badges which should be disabled are staying disabled, yet the WATERCRESS badge is disabled. This is on Legacy UI. This is my end result:
    and this is on computer live test(no emulator or anything). What is happening?
1 Like

Yes, the app is behaving as expected.

You are storing calories required as text which makes ‘5’ greater than ‘3’ and get activated.

[Suggestion]
Can you change ‘50’ in the list to ‘050’ and run your app and see the output.

1 Like

@muneer You are a genius! This worked beautifully! Thank you so much… You solved that seemingly complex problem in a single post!

1 Like

Thank you for the exceptional praise.

1 Like

There seems to be another problem, though. I have a calorie-number that’s smaller than 50(11 calories), but still the WATERCRESS badge is remaining locked. Is the 050 affecting it, and what can I do to change it?

1 Like

I haven’t noticed it in the code. Anyway, all your numbers should be 3-digit with leading zeros if required. So “11” should be stored as “011”

In the other hand, you can redo you list as numbers instead of text
image
And make sure you are storing the calories in your table as numbers too so you can compare like to like.

1 Like

Sure, thanks, will do that. If I redo it as numbers, then can I change 50 from 050 to 50?

1 Like

When you write the values as numbers, the system will ignore the leading zeros even when typed.

1 Like

OK, thank you so much! It works perfectly now.

1 Like

Welcome the same much dear.

1 Like