CountMe(%Row Count%)
def CountMe(n): import arcpy if n > 0: return "true" else: return "false"
I just did something similar to this yesterday. I have a test model and a code that might be a good reference. I just created 2 tables with different row counts to test and used a model parameters as input :import arcpy rowcount = int(arcpy.GetParameterAsText(0)) if rowcount >= 1: arcpy.SetParameterAsText(1, "True") arcpy.SetParameterAsText(2, "False") arcpy.AddMessage("Rows Exist, updating table") elif rowcount == 0: arcpy.SetParameterAsText(1, "False") arcpy.SetParameterAsText(2, "True") arcpy.AddMessage("0 rows, updating table") else: arcpy.AddMessage("Code Didn't Work") del rowcount
import arcpy rowcount = int(arcpy.GetParameterAsText(0)) if rowcount >= 1: arcpy.SetParameterAsText(1, "True") arcpy.SetParameterAsText(2, "False") arcpy.AddMessage("Rows Exist, updating table") elif rowcount == 0: arcpy.SetParameterAsText(1, "False") arcpy.SetParameterAsText(2, "True") arcpy.AddMessage("0 rows, updating table") else: arcpy.AddMessage("Code Didn't Work") del rowcount
import os, stat if os.path.isfile(infile): # checks if exists, otherwise get error if checking size on non-exist file os.stat(infile)[stat.ST_SIZE] ## returns size of file 0L if empty else: print "file not exist"
def CountMe(n): if n > 0: return True else: return False
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.