Use a Search Box to Scroll to a Repeating Group Entry With a Different Data Type

I am trying to use a search box with a different data type than the repeating group it is searching, and I haven’t been able to get it to work.

My simple database structure:
Data Type: Restaurant
Data Fields: name (text) and happy_hour (List of Happy Hours)

Data Type: Happy Hour
Data Field: restaurant (Restaurant)

My search box is dynamically searching the “name” data field for the Data Type “Restaurant”

The repeating group’s data type is “Happy_Hour” linked to the Restaurant data type

When the search box’s value is changed, a workflow is triggered that scrolls to the repeating group entry where the search box value = the name of the restaurant.

Is it possible to use a search box with one data type to search and scroll to an entry in a repeating group that has a different data type?

Your approach looks ok to me, not sure why it’s not working. The only thing I would try is to remove the “Reset relevant inputs” after the scrolling. Maybe that’s resetting the SearchBox value before scrolling is finished :man_shrugging:

Otherwise I can have a look at the app if you share the link.

1 Like

Thank you! I really appreciate your offer!

I ended up creating a new app so I could simplify my database to try to debug it more easily. I found that the conditions I had set up for the “sort by day” filter were not allowing the search to show even though it was being processed correctly.

Here’s an example of the conditions on the repeating group. There is one for each day.

I added the “and Searchbox Happy Hour’s value is empty” to the end of each condition and added one more condition that allows the searchbox to work.

So, now it works!

But I can imagine my current setup is going to eat up a lot of workload units. Do you know if there is a better way to show the happy hours based on the day sorted? Or a way to save some values so I’m not constantly using the “Do a Search” expression whenever the user changes the day or makes a search?

I was thinking of trying to use custom states but I’m not sure if this would help when I still have to do a search each time the day filter changes or a search is entered.

If the “Do a Search” expression is on a condition, do you know if it does a search every time the condition is met, or does it do one search and then remember the content of the search for the user’s current active session on the website?

Thanks again for all of your help!

State lists are not dynamic so you’ll need to setup appropriate workflows to keep it updated. Alternatively you can use plugins to store your dynamic list or you can use a 1px by 1px repeating group.

Having this many conditions does seem a bit much and maybe unnecessary. Is there a reason why you cannot use “Search For: Day = Dropdown Sort by day’s value”? But this would be more like a filter than a sort.

For a sort you could directly use the “Sort by” field and select “day” (but this field needs to be a number then). And select “Ignore empty constraints” so that if the dropdown is empty the sort is ignored.

I would expect the Search to execute when the condition is met.

I did what you suggested and it’s working perfectly now. Instead of having nine conditions I now have two. One for the search box and one for filtering by the day of the week. Thank you for your help!

1 Like

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