😵 Very Tricky: Need to create a list that includes null values

Dear Bubble fam,
There’s a list of orders stored inside each User. However, not all users have orders.

I need to create a list of total orders for each user, but get 0 or null if that user has no orders.

Experimenting with “group by…” and aggregating with count, but am only getting values from users with orders.

Any leads on this would be of great help!

Do you also get the users with empty lists or they don’t even show up to be grouped at all?

Can’t you just make (2) “Do search for” request and save the returned data to a state on the page? one state can hold the users with orders and the other state can hold the user with no order…but the primary question would be is what do you want to do with the list? display it in a RG or manipulate it?

if your displaying it in a RG then you can use the states as the date source and use the :merge to combine the two lists

Hey Vini, they don’t show up if they don’t have orders.
Suppose my list of users: Tuna, Timmy, Tina, Tom and Tony. Only 3 of them have orders.
When grouped by user, aggregated by count, my list will only have 3 values, but my user list is 5 values. That’s the issue I’m trying to solve.

Hey Shawn, I need to extract data from my list of users, and have that list be the same “length” and in the same order as my list of users. This so I can add it in a Table / Grid view plugin made by @Thimo

I’ve combined two lists in a similar way as you’re suggesting, but merge will change the order of the list, thus not workable for a Table.

I know @keith is one of the best around here for working with data and lists. Do you think this is possible? It’s sort of an iteration: check how many orders user 1 has, user 2, user 3… and so on and make a list from the count of each user.

You just mentioning Keith already triggered the iteration powers in me :joy:

Try iterating on the list of users and in each iteration store the list of orders:count in a list, use list shifter to generate a list that accepts duplicates to store the numbers.
Then display that list or do whatever, always using list shifter or list popper plugins to not deduplicate a list.

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