Show/Hide Text Elements in a Repeating Group

I am trying to show a list of restaurants’ happy hours. For each restaurant I would like to display the name, happy hour hours, and the happy hour offering.

I have been able to create a repeating group that displays all of this information, however, I can’t figure out a way to hide the restaurants’ that don’t have a happy hour on a specific day.

A simple version of my database structure:

Data type: Restaurant

Data fields:

  • happy_hour (list of Happy Hours)
  • name (text)

Data type: Happy Hour

Data fields:

  • happy_hour_offering (text)
  • day (_Days_Of_The_Week)
  • opening_hour (_Hours_Of_The_Day)
  • open_am_pm (Hours_AmPm)
  • closing_hour (_Hours_Of_The_Day)
  • close_am_pm (Hours_AmPm)
  • restaurant - Restaurant - Data Type

Option Sets listed above

  • _Hours_Of_The_Day - this is an option set containing the 24 hours in a day split into 15 minute increments.
  • _Days_Of_The_Week - This is an option set containing Sunday through Saturday
  • _Hours_AmPm this is an option set containing the values am and pm

Repeating group and text elements:

Conditional formatting in repeating group to display the correct restaurant name, hours, and offering on the day selected:

What it looks like when the restaurant does have a happy hour on the day selected:
Screen Shot 2023-10-23 at 2.46.08 PM

What it looks like when the restaurant doesn’t.
Screen Shot 2023-10-23 at 2.46.13 PM

How can I remove the restaurants’ that have happy hours just not on specific days? Thank you!

This group that displays the restaurant’s ‘happy hours’… you put a conditional on it.

If number of happy hours = 0, ‘this item is visible’ = no

@icaroalmeida, thank you for the response!
The group that displays the happy hours is the repeating group with three text elements. It looks like this:

Screen Shot 2023-10-23 at 5.29.56 PM

Are you recommending putting the conditional on the repeating group? If so, would you mind trying to write out the expression I would use?

This is what I came up with:
Screen Shot 2023-10-23 at 5.34.44 PM

Thank you for your help!

No the condition is in the data source.

For Instance today day is Monday. so you only want to show those restaurants who have happy hours on Monday and hide those who do not have ?
Am I right?
If this is what you want I think instead of making a “Do a search for:Restraunt”
Make - “Do a search for :happy hours”
condition- “Days of the week contains current day”

Adn you have already linked the happy hour to a restraunt so in the repeating group to populate the name of the restaurant you can use “current cell’s happy hours restrunts name”

now in every 24 hours you can update the current day option set to make this entire process dynamic

Hope this helps
If any point of my solution is wrong feel free to reply this helps me grow

This seems like a very complicated way to store happy hours. Why not just a openingTime (number 1-24) and a closingTime (same)? It would also allow you to find records already in progress or upcoming etc…

Thank you to everyone who chimed in with some helpful recommendations. I realized I was using “Do a search” for the Restaurant data type and when I switched it to the Happy Hour data type I was able to get everything to display and hide how I would like it.

@nocodenikhil I ended up using conditional statements to show the happy hours according to the day selected in the drop-down. Here’s what that looks like:

@code-escapee One reason is because a restaurant’s happy hour offering on Monday is different than the offering on Tuesday. A second is because I liked the formatting more this way and it is more clear for the restaurant when setting up their happy hour times in their dashboard.

Again, thank you all for your help!

I get that it’s different hours for different days and that the front end should display as hours and 15 minute inrements and am/pm. But DB wise I suggest it be stored as a number e.g., 5:15pm = 17.25

1 Like

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