Dynamic Increment

Good night.
I want to use the “Is Favorited?” on my app to increase or decrease.
I tried using the “Creating Action”, but nothing is happening.
How could I approach this?

Are you trying to get the total number of times an item has been favorited?

Hi @Robert_Petitto.
Thanks for the reply.
I’m trying to use just the “true” or “False” values.

Can you describe more about your use case here? Do you want to create an action on top of the user favoriting an item?

You’ll want to use a conditional “create action”. If it’s false > set column to true. If true > set column to false

How it would work

  • User “Favorite” an item, the value would be “true”.
  • When the user had favorited to be true, It would increase +1.

If the User used again, the value would be false.

  • Then it would decrease -1.

Since i couldn’t do that by Glide Tables, i found the “Create Action”.
So i tried using it, but with no response.

Do you have a photo of the settting?
No luck setting it up here.

What is the +1 or -1 column for in this case?

The “isFavorited” column already stores your true or false value.

LIke the images below.!

  1. Favorite Button and Action (IncrementIt) :
  1. Action of “IncrementIt” :
    image2

3)Glide Table settings :
image3

When i click on the favorite button, its stores the checked value but does not increase the value.
If i click on the option, not the favorite button, its increase or decrease the value.

The favorite button does not have an action tied with it, as far as I aware. What do you use the VisibleIncrement column for?

I use it to store the values “1” 0r “0”.

  • 1 is fof “true” value.
  • 0 is for “false” value.

Then you can just use an if then else column, if true then 1, false then 0.

1 Like

How I set this?

What i trisd:

  • I have a collumn for the Favorite Button, “Is Favorited”;
  • Then a collumn that reads it, true or false, using a if statement;

But the “Action” does not work. Just works if i click the option instead of the “Favorite Button”.

image4

I mean if you just need a 0/1 value then use an If Then Else column on top of the isFavorited column, you won’t need an action for that. Basically it looks like you’re trying to convert the false/true text value to the 0/1 version.

Hi @ThinhDinh . Thanks for the reply.
I need the action to convert to 0/1 values 'cause it uses a glide table link.

  • I use the same table in another app;
  • One app is for clientes;
  • The other, that has the increment action, is for admin only.
    Any sugestions how could use this?, or do i have to put it together in one app only?

It doesn’t matter if you use a Glide Table or a Sheet, the If Then Else column is a Glide computed column and will always stay in Glide. You don’t need an increment action here if your sole purpose is to convert the false/true value into 0/1, you just need the ITE column as I suggested above.

1 Like