I am positive it is my lack of expertise that prevents me from knowing this, but how do I save a report file to the same CSV file instead of making a new one each time. I have over a hundred CSV files when all I need is to save the new data to the existing one and repeat.
This is in the Report / Schedule actions.
Thank you for any assistance.
Could use the runScript scheduled action and do something like
myFile = "C:\\MyFolderPath\\TestCSV.csv"
system.file.writeFile(myFile,reportBytes,1)
The 1 on the end specifies Append.
I will give it a try.
Thank you.
You put a 10 instead of 1 for the boolean “append” parameter.
@MMaynard gave you a python script but you’re in an expression editor. I’m not sure if what you’re trying to do is possible without custom scripting? Maybe a report expert could shed some light @KathyApplebaum
What was your original FileName settings for Save File before adding the python script?
{Report.Name}
- " "
- dateFormat(now(), “M-d-yy hha”)
1 {Report.Name}
2 + " "
3 + dateFormat(now(), “M-d-yy hha”)
4
try this:
{Report.Name}
What’s happening is whenever the file is saved your specifying a new name with the date stuff.
Remove the date stuff and your file will overwrite every time.
You can manually execute the schedule by clicking the arrows:
With the current script, I get a new file every scheduled save.
I dont want to overwrite the data, I want to add to a single file.
Oh I see. I’m not sure if this is possible without a runScript() call to a custom script.
Change your Action to a Run Script and use @MMaynard code.
Dont use a save file action, use a run script action with the code I gave you and a non changing file name.
You aren’t indented as python expects, and you aren’t doubling your backslashes.
Hourly_DT_Query = “C:\Path\ToFolder\HourlyDTQuery.csv”
system.file.write(Hourly_DT_Query,reportBytes,1)
This is my last iteration and it still doesnt work
Only one \ after Path, double it
Hourly_DT_Query = "C:\\Path\\ToFolder\\HourlyDTQuery.csv"
system.file.write(Hourly_DT_Query,reportBytes,1)
Still no luck
My file name is Hourly DT Query