Choice options not updating

This is driving me mad :frowning:

I have a choice button pulling from an options table

image

I am trying to add in another option for the “over 60s” but it will not take it, I have tried duplicating the widget, different styles, refresh/resync. Reloading the app but it will not doing. If I make a change to the existing text of options like “over 25” to “overs 25” it works, just will not display the over 60

I am other choice on the same tab and I can add extra options to them, hence I don’t think its a bug, just something I have done wrong.

image

Thanks in advance

I think it’s because your underlying value is the same. Meaning you have two choices that result in 1.00. Should it be 1.00 or should it be a different number? Glide attempts to remove any duplicates in the choice component. If you have a separate underlying value that’s saved instead of your display value, then it will eliminate the duplicate underlying value.

Think of it backwards. If you were editing an existing row of data and you had a 1.00 for the value, which choice would you expect to be chosen on the edit screen? Glide wouldn’t know which one to mark as chosen, because two of your choices result in the same value.

2 Likes

mm… you are correct if I change it to anthing other then 1.00 it works.

It needs to be 1.00

Its for an insurance app, if you are over 25 there is no age loading so I need it to be 1.0 BUT if you are over 60 then there is no tax. I guess the easiest way will be more me to have a separate button to say if they are over 60 to deal with the tax ??

I would maybe just store some kind of unique value for each choice, but then have an IF column (or a relation/lookup) that returns the correct number, based on that choice, for use in your math. I’m guessing either way you need unique values to know which choice was selected. Currently, how would know which choice a user selected if both of the values are 1.00? If all you had to go on was the number 1.00, you would have no way of knowing if a user selected ‘over 25’ or selected ‘over 60’. You need some kind of value that will indicate to you which one the user chose. It’s the same way with the choice component. It has no way of knowing if a user selected ‘over 25’ or ‘over 60’ once that data is written to the table. It becomes ambiguous once the number 1.00 is written in the table.

2 Likes

correct. I just realised that I am not actually storing the text, that is only being displayed and the value is the only thing I am storing, so as you highlight I will not know. I will look at the IF statement logic.

Thanks

2 Likes

I would do the following:

  • 4 columns in your options table
    – Age Group ID (1, 2, 3, 4)
    – Age Group (text)
    – Age Loading
    – Tax (rate/boolean?)
  • In the choice component I would use Age Group ID as the value and Age Group for display
  • I would create a single relation column that joins the user-selected Age Group ID to Options->Age Group ID
  • Finally, two Lookup columns to fetch the appropriate values for loading/tax via that relation.

Age Group ID isn’t strictly necessary - you could just use the text representations of your age groups as both value/display, and then use that to build the relation. But I usually try to avoid hard coding column values like that as it’s a bit fragile.

3 Likes

Hey Darren, wow…

I have already implemented it using the IF-ELSE algo… and it seems to be working. I’ll see if I have time to change it but definitely this is a very useful concept that I can apply in other apps

thanks

1 Like