I have this repeating panel that displays the search between certain dates or of specific items bewteen dates selected by the user, I need to produce a pdf, but I dont really understand server modules or what part of the search function can I put on the module so I can call it like some users has done to tell the render form to take only the results of the table for the pfd and not the rest of the form, how should I approach this?
I generated the PDF but the results werent show on the pdf, it looked like the form without the results in the repeating panel
this is the only thing on the server module that I have writen:
import anvil.pdf
import anvil.media
@anvil.server.callable
def reporte_pdf():
media_object = anvil.pdf.render_form('registro_listocar.registro_listocar_reporte')
return media_object
and the button that does the search between dates and a text parameter has this:
def button_busq_placayfecha_click(self, **event_args):
start_date = self.date_picker_2.date
end_date = self.date_picker_3.date
busq_placa = self.search_placa_box.text
queries = [q.none_of()]
if start_date:
queries.append(q.any_of(fecha=q.greater_than_or_equal_to(start_date)))
if end_date:
queries.append(q.any_of(fecha=q.less_than_or_equal_to(end_date)))
if busq_placa:
queries.append(q.any_of(placa=q.full_text_match(busq_placa)))
self.repeating_panel_reporte.items = app_tables.registro.search(q.all_of(*queries))
pass
my button for the pdf has this:
def b_emrep_listocar_click(self, **event_args):
media_object = anvil.server.call('reporte_pdf', self.repeating_panel_reporte.items)
download(media_object)
pass
if you wish to check the app:
https://anvil.works/build#clone:EYYVCSAV7EIDK6BC=FBKUNUHK3P44N6AIE5AHJ4OS