Report schedue by script

Hi, I want to use this script :

data_list = [[“TYN”,“001”],[“TYN”,“002”],[“TYN”,“003”],[“TYN”,“004”],[“YPG”,“001”]]
today = system.date.now()
date = system.date.format(today, “yyyy_MM_dd_HH_mm_ss”)
for data in data_list:
paths = “D:\reports” + data[0] + + “\report_Auto”
settings = {“path”:paths, “fileName”:data[0]+"_"+data[1]+“report_Auto” + str(date) + “.pdf”, “format”:“pdf”}
system.report.executeAndDistribute(path=“report_Auto”, project=“test”,action=“save”, actionSettings=settings)

maybe there’s something wrong with “paths”, I want to dynamic change the paths by “data_list”, how can I do?

Path only supports a single filepath. If you want to save the same report to multiple destinations, use system.report.executeReport to get a byte array, then system.file.writeFile to write it to each of your separate destinations.

1 Like

Thanks , I look for these two , but I don’t know how to use .

There are examples in the documentation for each function: https://docs.inductiveautomation.com:8443/display/DOC79/system.report.executeReport and https://docs.inductiveautomation.com:8443/display/DOC79/system.file.writeFile