Data in repeating panel to a new form

What I’m trying to do:
I have a database with bus routes inside. The columns in my data base go as: Number, Name, Stops, Departure, Departure time, Arrival ect. I have a search function that searches the database for a user input and populates a repeating panel with only the Name, Number and Stops of each route that match the users search. Next to each route that appears in the repeating panel there is a button saying “Details”.

When the user clicks the “Details” button for a route in the repeating panel, I need the program to open a new form and display the rest of the information about the route from the database.

What I’ve tried and what’s not working:
I have added code into the repeating panel template form, and I have been able to get the button to open a new form, just not display the data from the corresponding route, and the rest of the corresponding data in the database.

Any information or help would be appreciated!

can you share a code snippet or clone link for what you’ve tried?

Here is the code I have in my repeating panel template:

At the moment, it just opens the Route_Page form, but I can’t get the data from the repeating panel to display in the Route_Page.

The issue is you aren’t passing any data to RouteForm. So you need to pass the data as positional or keyword arguments after the “RouteForm” argument and then manipulate those values within the RouteForm object

1 Like

In particular, you’d want to pass self.item to your new form so it has access to the entire row. Then in your RouteForm’s init function you’d add an argument for the row, e.g.:

  def __init__(self, routeInfo, **properties):

There are other alternative, too. For example, if you wanted the user to dismiss the detail info form and still be viewing the list of routes, you might open RouteForm in an alert instead of a separate form.

It just depends on how you want the app to work. Anvil gives you the flexibility to make it work the way you want.

1 Like