Retrieve data in particular order to a repeating group

I am using external SQL data on one of my pages but I’d like to change that to using the internal Bubble database. The issue is that on my page, I present data in a particular order, using Item #1, Item #2, etc. I can do this because in the SQL statement I have the query option “Order by field” to retrieve the data fields in that particular order.

I also have the option to sum the fields as they’re retrieved.

How can I achieve the same thing using a Bubble database?

This is an example of the formula from one of the fields retrieved:
image

This is the SQL query named “get_totals” that is used in the field above:
SELECT Category, sum(Total) FROM db_OE-Bubble.Operating Statements
Where PropertyName = ?
Group by Category
Order by field(Category, ‘Gross Potential Rent’, ‘Loss to Lease’, ‘Losses to Vacancy’, ‘Losses to Concessions’, ‘Collection Losses’,
‘Total Rental Income’, ‘Other Revenue’, ‘Total Revenue’, ‘Taxes’, ‘Insurance’, ‘Repair and Maintenance’, ‘Administrative’,
‘Management Fees’, ‘Marketing’, ‘Utilities’, ‘Contract Services’, ‘Salaries and Personnel’, ‘Total Operating Expenses’, ‘Net Operating Income’)
limit 100;

Hello,

In the search of a Bubble repeating group you can add the sort fields and follow the search with a “group by” operation where you can aggregate them

Ok, thank you, the “Group by” option helps but is there no way to “Order by”? I’m looking for a consistent way to present the same data but it’s not going to be in the DB in the same order for each property. The default, even without selecting a sort seems to be alphabetical by the “Group by” field and that’s not even close to what my output needs to be.

I guess, outside of a RG I could use individual Constraints for each field but it would be nice to be able to enter a single request for the constraints like with the SQL statement. Inside an RG, where I’d like to use this, there doesn’t seem to be any option for setting a specific constraint for a cell.

… blame it on visual programming … what a drag :grimacing: