I’m trying to create a search that removes multiple rows from a data table based off of a date range, but I’m not sure what the syntax would be for that. This the search that I have set up to create a CSV file… I want to make the same thing but I want it to just remove the rows.
thank you in advanced.
@anvil.server.callable
def get_media(date,endD):
my_string=""
for row in app_tables.trucklog.search(Date=q.between(date,endD,max_inclusive=True)):
Date=row['Date']
DateTime_txt=row['Time'].strftime("%I:%M %p").replace(',','')
TruckNumber_txt=row['TruckNumber'].encode('utf-8').replace(',','')
Comments=row['Comments'].encode('utf-8').replace(',','')
Material_txt=row['Material']['material'].encode('utf-8').replace(',','')
DispatchTxT=row['Disptxt'].encode('utf-8').replace(',','')
CompanyTxt=row['Trucktxt'].encode('utf-8').replace(',','')
record=','.join([str(Date),str(DispatchTxT),str(CompanyTxt),str(TruckNumber_txt),str(Comments),str(Material_txt),str(DateTime_txt)])+'\n'
my_string+=record
m=anvil.BlobMedia('text/csv',my_string,name='DataLog.csv')
return m