Hi Juan,
Things are working well with my project.
Something else I am looking to achieve, which would improve the success rate of my results...
'If' there was an issue with the scrape, which resulted in an empty CSV - is there a way to make sure that the CSV is not exported?
Importing an empty CSV into my website would cause problems, as it is configured to delete data from the website that no longer exists in the CSV.
Thank you.
Only export to CSV if not empty?
Re: Only export to CSV if not empty?
I'm assuming you have a table that you don't want to export if it's empty? Supposing you have a table called Test, you can first create a query by right-clicking your table (Data.Test in this case) in Project Explorer, selecting Create Query, leaving everything with the default values and pressing OK. Then you can do this:
What that's doing is taking the first row in the query (this is just an optimization) and getting the length, which can be 1 if the table has contents or 0 if it's empty, and then exporting only if the length is 1.
Code: Select all
Action.SequenceFirst
· Sequence.Length
· Sequence.First
· Query.Test
as length
if
· =
· length
· 1
· Action.ExportData
· "Test"
· "test.csv"
· true
· Action.Log
· "Data was empty."
Juan Soldi
The Helium Scraper Team
The Helium Scraper Team