Forum Academy Marketplace Showcase Pricing Features

Saving data in list

Question about lists in Data types.
In the User table I have a field called ‘company_id’, which holds an ID for the company. It’s a fixed number.
I have another data type that holds financial data (called cashflow). The data is loaded via the API and is updated daily. Some lines are removed, some lines are added. Each line comes with a Company_id.
If I add Cashflow data as a list to User table, I should be able to get all the data that is related to a certain company_id. However, every day some of the lines are removed and some new ones are added in an automated process. How can I update the list that holds the cashflow data in the User table with these new lines and removed the ones that are gone from cashflow?
I hope my question is clear… if not I would be happy to know.

Hello!

Sam here, with Bubble support. I actually wouldn’t recommend storing a list of cashflow data on the user data type. There are two main reasons why:

  1. As you mentioned, the data will be changing constantly, and the added lift to keep this list field updated probably isn’t worth it when there is a much easier way to access the data
  2. List fields are not performant at scale. In general, list fields should be used for smaller, more contained lists of things. Once a list field exceed 100 items, and especially as a list field grows beyond 1000 items, it is much faster to “do a search for” a different data type.

Here, any time you need to access a user’s cashflow data, I would just use the expression “Do a search for cashflows where company_id=current user's company_id

This search will be performant as it isn’t running any sort of advanced filter and just searching a table based on a single constraint. It will be the fasted way to access your data, and it has the added bonus of always returning the most updated data without any additional lift.

Let me know if this makes sense - I’m happy to clarify if anything is unclear!

Hi Sam,

Thanks for your answer! Oke so not using lists…

Now I am trying to make a repeating group with my table that contains all the data. It looks like this and I also included an example of how my repeating group should look:

On the repeating group, I did this:
image

Put a constraint as well to filter out only the data for the company id that is in the custom state:
image

On the aggregated weeknumbers I do this:
image
which gives me the week numbers like i want them in my Excel example.

Total also going fine:
image
(‘Bedrag’ means ‘Amount’)

Now comes the difficult part, how to filter out only the 'D’s and 'C’s that are defined as Category and aggregate them in the same column for each week? I can’t figure it out…

Hi @sam.morgan, I found a solution. Inside the repeating group i put another repeating group, where I filter first on the week that is in the parent grouping, and then group by the category filtered on the categorie I need.
Do you think that is a good solution or do you suggest anything better?

Hi Arend! Yes - nested repeating groups are a perfectly acceptable solution - ultimately, there’s really no “correct way” here - there are generally a number of different ways to structure and execute a particular feature, and the way the makes the most sense to you is generally the best option!