Forum Academy Marketplace Showcase Pricing Features

Database: are percentages considered 'numbers' or 'text'?

I am creating a database for customers. Some of them will have a discount. Are the discounts, if expressed in percentage terms, considered numbers?

if it considered a number, is it possible to have the value represent either a percentage OR a specific value? So, for example, instead of a 10% discount on all orders, maybe I want a customer to have a $10 discount. I am guessing this might actually have to be done with separate ‘discounts’ columns in the database?

thank you!

Hey there,

If you are trying to create discounts, then yes you will have to have multiple fields for the data type. My recommendation is to have the following fields:

  • Discount (Fixed Amount)
  • Discount (Percentage)
  • Type (Fixed Amount of Percentage)
  • Users (List of users that have this discount)

From here, you could have a conditional statement that would check the type of the discount and then trigger one of two workflows based off of the result.

For example, when the checkout page is loaded, you could have two seperate workflows in which one would trigger based off of the type of discount that the user has.

The fixed amount workflow could simply subtract the value of the coupon from the subtotal using “Make changes to a thing.”

Due to the fact that there is not a “percentage” data type in Bubble, you would have to treat it as a number. Therefore, in the percentage workflow, a little math would be involved to subtract the percentage off from the subtotal.

I did not get a chance to fully test out an app like this yet, so this is just what I was thinking, but I’ll try to create one today and share the result with you to provide an example of what this would look like.

1 Like

I’m back!

I was able to develop a test app to accomplish the task you are requesting. You can see the demo here: https://discounttest.bubbleapps.io/ and check out the workflows/database structure here: https://bubble.io/page?name=index&id=discounttest&tab=tabs-1

It turned out to be more complex than I originally imagined, so some of the db/workflow stuff may seem confusing to you. Feel free to let me know if you have any questions about it!

Hope I helped! :slight_smile:

2 Likes

@blowenthal, that demo was amazing. Really helpful to see everything flowing together. The next step is to link this information to a fast-food style check out tool.

Thank you so much!

Of course, happy I could help! :slight_smile:

Feel free to let me know if you would like any more demos from me!

Did you take the demo down? Would love to see how it works.

Unfortunately, I take my forum demos down after a week or so. Apologies for this. :frowning2:

Essentially, the demo just checked the type of coupon that it was, then applied either a fixed discount or a percentage discount depending on the type.

The way that the coupon is applied to a user is through a custom field under the thing “User” with the type of a Coupon.

When the page is loaded, a workflow is setup to check to see if the user has any relevant coupons. The grand total is then adjusted from the subtotal based off of that workflow.

Actually, I am assuming the first part above would be useful for solving another issue I am having.

In that checkout system above, I have it set up to display a repeating group. So any time I create a new thing through an input, it shows up in that group.

However, I need to start categorizing the things in to different repeating groups. In the case of our business, one set of things might be laundry, and another dry cleaning. So I would need to create a bunch of things, classify them as either dry cleaning or laundry, then have multiple repeating groups. Each group displays only one type of thing, so all laundry, or all dry cleaning.

Could a similar method be applied to get that kind of sorting?

Hi @blowenthal

It would be awesome if you let us see it! I’m working on a similar project to @jameslusk

I’m looking to add the possibility to customers to include 10% of the total of their orders, as tip. This is for a pizza place app.

So, if it’s possible to check out your demo to better understand the process, or if you can guide me on how to achieve this, it would be greatly appreciated

Thanks in advance!