Populate Dropdown with Months and Default to Current Month

Hey all!

I have an app with a repeating group that pulls out data for upcoming appointments. The layout is similar to Calendly where each repeating group cell is a new appointment and if you click on the appointment, it has another dropdown that shows more information about that appointment. My question is - I want to be able to filter the appointments via a dropdown populated with the Months and have the dropdown default to the current month. I currently have an option set that has all of the months as well as an attribute that has its respective number. I feel like this may not be the correct approach though. Any input on how to achieve this would be great!!

Hi there, @richard22… if I understand your post correctly, the option set sounds like a reasonable way to go. Where I believe an issue will arise is that in order to use the selected option’s attribute to filter the repeating group, you would have to use an advanced filter to extract the month from the appointment’s date so it can be compared to the attribute (I assume you would want to compare the year, too). As you may or may not know, advanced filters take place on the client side, so the repeating group’s search would return all of the appointments in the database to the browser, and then the filter would be applied. As you can imagine, that might not be ideal from a performance perspective.

One way to get around the need to use an advanced filter would be to have a field in the appointment data type that stores only the month associated with an appointment’s date. With that field in place, you would be able to use a regular constraint on the repeating group’s search (something like appointment month = dropdown's value's attribute), and the search would return only the appointments that meet the constraint.

Anyway, I guess that’s all just food for thought, and I hope it helps.


Thanks for the reply @mikeloc ! Definitely much appreciated and that’s a good idea about adding a month field in the appointment datatype. I think I’m going to take that route.

I’ve attached a screenshot of part of the app and circled the dropdown. Any idea how I can have it default to the current month? I don’t want to have to search the DB and look for the most current month on any appointment, but I would rather have the dropdown default to the current month on page load and when a search takes place, it will initially filter the results based on the default month. So right now, I would like for the dropdown to have all 12 months in it, but have it default to August and then dynamically update to September. Is this possible?

I don’t see a screenshot, but yes, it is possible to default the dropdown to the current month.

1 Like

Ahhh totally forgot to attach it!! This totally worked though! Thank you so much. I was pretty close, but my attribute wasn’t set as a number in the option set and I wasn’t grabbing all of the months in the default value properly, but it’s totally working now. Much appreciated!

1 Like

I had the same problem. But as seen in your screenshot i am not getting the All Months option in default value to which i can apply a filter then

I can’t help without being able to see your setup, @abhineet.agr. If you share some screenshots, I’m sure we can figure out what’s going on.