Help with adding credits (as a thing on a list)

Hi fellow bubblers!

I am creating a subscription app. One of the functions I need it to have is the ability to historically track the “credits” every time a user adds. I was able to do “a part of this function” this successfully as shown on below screenshot :

Now, a credit can be just an additional 1 point, or 2 points, etc. So the credit, as a thing, will be added multiple times. For instance, as a user, I can add 1 credit on my account today. Then add another 1 point, tomorrow.

I realized that Bubble doesn’t add a thing on a list if it is already on there, hence, as ssen on the screenshot above, if I add 1 more credit, the list will only have 1 item on it because it will be read as a duplicate.

This next screenshot shows that I have tried to add 1 credit 3 times but bubble only listed 1 thing and considered the other 2 as duplicated but also shows “something was added 2 more times” as seen on the creation date.

Can someone kindly help me find a way to track credits being added? I was thinking instead of numbers I can just add actual letters so Bubble wouldn’t find entries as duplicates - ie ONE, TWO, THREE. But then that’s going to look really weird.

Your help would be super appreciated! Thanks in advance!

I think your credit ledger needs to be a separate Data Type as opposed to a list of things. Then your credit ledger will represent the relationship between your users and their credits. Then when your users add credits, your workflow will add new records to the ledger, without the restriction you’re currently running into.

Hi there!

Yes, I have a separate data type for credits so I can track the unique creation date for each entry

image

my problem is not displaying the data. I am able to see the credits and the creation dates. My problem is :

Day 1 : Added 1 credit
Day 2 : Added 1 credit
Day 3 : Added 1 credit

Bubble Results : Only shows Day 1 entry because bubble is reading day 2 and 3 as duplicates as it is the same entry which is “1”.

What I would like the table to show is 3 entries. So essentially a need a way for bubble to ignore the entries as duplicates.

I hope I was able to provide more clarity on the challenge.

Can you please share a screen shot of the fields within the credit data type. I think that will help the problem solving.

Hi!

Yes, here’s a screencap of the fields within the credits data type

So essentially I just need Bubble to accept multiple entries and not count them as duplicates for this specific function so I can keep a record of credits added as my users might want to add 1 credit per day for 5 days, hence the entry titled “1” will be added as an entry multiple times.

Quick follow up question: Do I interpret correctly that you have the email address in there to connect back to the user?

Yes that’s right. So I am able to associate the credits to the user successfully. I linked the credits data type to mytable.

Okie Dokie. Here’s my recommendation:

Firstly, let’s fix your data structure…

  1. Change the email address field to be a field of type user. This will be enable some of the following steps we will do, and is better practice for data structure.
  2. Change the topup and topup2 fields to not be a list. They should be single entry fields.

Now lets fix the workflows:
3. In your workflow where you add a credit to the user, add a completely new record every time. This was my earlier point that the credit field shouldn’t be a list.
User = current user
Credit as applicable

  1. Then to see the added credits for the user, create a repeating group with the datasource “Do a search for credits for this user”.

Thanks so much, I will try this on my app and keep you posted! Thank you again!!! :slight_smile:

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.