Sorting By Option Set?

Hello,

I have a data type called office hours and an option set called Days

In the option set, I have the days Monday to Sunday, with an attribute called order of type number, that is assigned to each day from 1 to 7.

In my repeating group of office hours, I want to sort the days by the order.

How can I achieve this?

Hey Mohamed,

In your repeating group, select as the data source: get an option(select days(all options)): sorted by order

I can’t use get an option since the data type is office hours. In my office hours data type, I have other fields I refer to such as office hours starting time and office hours ending time and some other information.

Hi Mohamed,

To make sorting easier, try this:

Add a numeric field in your Office Hours data type for the day’s “Order” (1 for Monday, 2 for Tuesday, etc.). Bubble only lets you sort by fields like numbers, so this will let you organize your repeating group by day correctly!

Hope this helps!

How do I make this dynamic when creating/modifying a thing? My users will create an office hour, and then would need to later modify it. So when I do “modify an office hour” do I need several conditions to specify each scenario for the different days?

When creating or modifying an office hour, you can have the user select the day using the day option set. Once they pick a day, automatically set the Order field to the order number associated with that day from your option set. This way, there’s no need for multiple conditions—Bubble will set the correct order based on their selection.

Hope that simplifies it!

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