Create Python code for running report

المشرف العام

Administrator
طاقم الإدارة
I want to create a Python code to run a report. The procedure usually used is go to the table options, after you select the desired rows, and select report then select run report and you browse to a ".rfl" file and the report will be generated, after that you export the report to pdf file. The Python code I want to create is to go through the rows one by one, and the one that falls between 2 dates (the code for select attribute based on the date field is: arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", "{0} > date '2015-01-13 00:00:00' AND {0} < date '2015-01-15 00:00:00'".format(arcpy.AddFieldDelimiters(lyr,"REQUEST_DATE"))) ) should run the report and save it as a separate pdf file with this variable name: UCBPREMPARCELIDREQUESTDATENAME.pdf (example: 452015-01-14John Smith.pdf), but if the row do not fall within the desired date the model should go to the next row. The code syntax for generating the report is:arcpy.mapping.ExportReport(lyr, r"S:\gisds\SW_InquiryReport(2).rlf", r"C:\Users\tarek\Desktop\Desktop_Tarek\testpdfreport4.pdf", "SELECTED")but I don't know how to make the name variable based on the fields as mentioned in the example, and how to make the model perform an if statement on each row and generate a pdf file for each row.

Any one can help me in this? I am now learning Python and I am not in a level where I can produce such a complicated model.

Please let me know if I didn't clarify my issue.



أكثر...
 
أعلى