How do I "grab" data from other data types, calculate percentages and create new records in a separate data type?

Hi All,

I have just started using Bubble and I’m blown away by it!! It’s so much fun and I’m finally going to be able to build the fitness web app I always dreamed of.

Anyway, this is kind of a general question about how to “grab” associated data from other Data types.

So, for instance:

I have a few “products” which are a series of in-person group fitness class packages which range in price and duration. These I am selling on my website. Some of the packages are “active” and some are “disabled” (yes/no field)

I have decided to bring in some “partners” - people who will bring clients into my business and who then get a % of the website listed price of each package.

I want to create a portal for these partners where they can go to set up their own prices for said packages but only have access to and be able to set their own prices for packages that are “active”.

They will sign up. (via a link I sent them) then they are taken to a page where they see the listed prices of the active packages (as per the website price), along with the discount they get (let’s say 25%) and the price they will get the package at and how much they will make when they sell a package to their clients.

They will then be able to set the price of the packages they sell on their side (anything they want as long as it is more than the price they get with discount %)

So, I was playing around and I find it very consuming.

First question I have is:

Where should these new records be saved? These records are the prices that each partner sets for themselves.

I thought of having a couple of “new fields” in the “‘partners’ data type” and setting them to “multiple entries” and here I would store the partners prices for each of the “active” packages, but the trouble is that if I disable a package later on, the data won’t “line up” with the comma-separated values in the “multiple” fields. And also, when I was trying to get dat from “multiple” fields into a “repeating group”, I wasn’t able to access the data in this field using “regex”. I don’t really understand how regex works.

My other solution (and I think this is the better option, but I would love to hear you guys - the pros - feedback on it) is to have a new data type called “partners pricing records”. Every time a partner creates a price for a package, a new record is created in this data type along with the “unique_id” from “partner” and the “unique_id” from “products” and it pulls in all the other information from the “product” records as it was at that time (in case product prices change at a later date).

The problem with this approach is that I am new to Bubble.io and I don’t understand how repeating groups work and how to pull data from various data types into a separate data type and I also don’t know how to even view different fields’ data from different data types in the same repeating group.

Also, I need a “calculation” field that will display the partners’ “I make this much per client” amount in each repeating group row for each active product.

So, here I find myself, asking the people with all the experience - to see if you guys have any solutions that could help.

More than a specific solution to this particular obstacle (although that would be welcome as well), I think I need an understanding of how Bubble pulls data from different places and pass it onto a new record of a different data type.

I don’t mind learning from some excellent sources around the internet, but I don’t think I have the patience to sit through the very basics of learning Bubble.

Anyway, thanks for your help - ahead of time.

Regards,

Ryan Ashton
Hong Kong

Hi
1.A quick solution could be using merged with expression which allows to merge data between more than one data type
2. I could set user role in option set ,
Then use privacy rules to set rule for the app owner and owner rule which allows bubble to display data regarding to user role
App admin will be able to see all of the data
While Owner rule will allow data to be displayed to creator of that data only
I hope it helps

The deal is not in RGs or Bubble features. The deal is how your DB is structured. Start from that before trying to build a features.

Will be helpful to get know about “double linked list” DB.

Example
DB- Product (Package) :
Required fields // like name , image, type, category etc
Disabled // boolean , yes /no
List of Partners or List of Custom Products

DB- Parthers:
Required fields // like name , id , transactions
List of Custom products

DB- Custom product:
Product (Product) // Product that you (admin) added manually to share with partners or any conditions.
Price // Given price by partner or result of expression (default price of a product with sale 25% off + partner custom price.

And it’s just surface

Thanks for the replies guys,

So this is the database/workflow design I came up with.

What do you think?

Feedback is welcome. Please let me know what I’m missing.

Thanks,

Ryan