Repeating panel Update

I got a repeating panel self.display_data which takes the employee punches from above (refer to picture) and puts it into a data table with all of the employee’s clock in/out.

What I am trying to do is when the button “End Shift” is clicked, the repeating panel should update to the new data table which has the employee data inside it.

So my question is how do you update the repeating panel to show the information? If I log out and log back, the data table reflects the last punch.


I tried something like this and vice versa, but I don’t understand it.

  def end_shift_click(self, **event_args):
    clockout_end_shift = self.Current_Time()
    clock = self.Start_back_from_lunch.text
    current_user_row = anvil.users.get_user()
    current_user = current_user_row['email']
    
    for row in app_tables.clockinoutsystem.search(q.all_of(Users=current_user,Clock_In=clock)):
      row['Clock_Out_End'] = clockout_end_shift
    self.end_of_shift.text = clockout_end_shift
    
    total_hours = self.total_hours()
    total_hours = self.TH.text
    
    for row in app_tables.clockinoutsystem.search(q.all_of(Users=current_user,Clock_Out_End=clockout_end_shift)):
      row['Hours_worked'] = total_hours
    
     
    # refreshing the time card view
    self.item = self.displaying_data.items
    
    return 

Clone link:
share a copy of your app

It’s very unclear what you want to have happen, so I doubt that you’ll get anyone offering advice. You’ve shown some code, which is good, but since we don’t know what you’re trying to accomplish, we can’t say where the code might be going wrong.

You’ll need to provide a lot more detail here. Can you lay it out step by step? Something like this:

  1. Repeating panel is filled with data from clockinoutsystem using the following search: app_tables.clockinoutsystem.search(whatever goes here)

  2. User clicks End Shift button

  3. Repeating panel should now be filled with data from ??? using the following search: ???

This should get you most of the way to what you want - just add some necessary validations to ensure that entries are made in the proper order, not duplicated, etc.:

https://anvil.works/build#clone:TUH4Q4OBOTTOXDLG=3YRXODP5372AIJ2PSNTHLTCR

1 Like

@nickantonaccio Thank you so much! That basically answered my question. I was struggling to update the self.repeating_panel_1.items when a new row was created. All I had to do was add that line of code after End_shift button which inserts it in the data table. You make us noobs so much better :slight_smile:

self.displaying_data.items = app_tables.clockinoutsystem.search(Users=current_user)