import arcpy, datetime currYear = datetime.datetime.today().strftime("%Y") arcpy.AddMessage("Current Year = " + str(currYear)) # Set Local variables num3YearsAgo = int(currYear) - 3 num4YearsAgo = int(currYear) - 4 num5YearsAgo = int(currYear) - 5 num6YearsAgo = int(currYear) - 6 num12YearsAgo = int(currYear) - 12 # Set up Selection Criteria to be passed to next step strCat1 = '"Surf_Hist_Pavement_Year" >= ' + str(num3YearsAgo) strCat2 = '"Surf_Hist_Pavement_Year" >= ' + str(num5YearsAgo) + ' AND "Surf_Hist_Pavement_Year" <= ' + str(num4YearsAgo) strCat3 = '"Surf_Hist_Pavement_Year" >= ' + str(num12YearsAgo) + ' AND "Surf_Hist_Pavement_Year" <= ' + str(num6YearsAgo) strCat4 = '"Surf_Hist_Pavement_Year" < ' + str(num12YearsAgo) arcpy.AddMessage(strCat1) arcpy.AddMessage(strCat2) arcpy.AddMessage(strCat3) arcpy.AddMessage(strCat4) # Set Output parameters arcpy.SetParameterAsText(0, strCat1) arcpy.SetParameterAsText(1, strCat2) arcpy.SetParameterAsText(2, strCat3) arcpy.SetParameterAsText(3, strCat4)
Hi all
I'm trying to use your script as an example for myself to try work out how to parse the SetParameterAsText results to a model's parameters. Your script works and runs but I simply cannot get the results into a subsequent model's parameters. I have tried looking for a clear example online that shows the entire process of setting the parameter text and then using it, but I simply don't know where to 'put' the parameter text. I'm sure it is quite simple, but I'm just not seeing it. Presently I've done your script, placed it into ArcGIS scripts with the parameters parsed into the ArcGIS, as per the example image below. However, now what do I do to place the derived output into the 'next' model/script?
Thanks,
Nigel