-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSortApplicationRecords.py
51 lines (34 loc) · 1.25 KB
/
SortApplicationRecords.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""--------------------------------------------------------------------------------
SortApplicationRecords.py
Description:
Sort application records by reference number for all point files in geodatabase.
Input:
1) A geodatabase with application points
Version 0.1
Created by: Juel Paul/Land Analytical
Date: June 7, 2020
--------------------------------------------------------------------------------"""
# Import modules
import arcpy
from arcpy import env
import os
inGDB = arcpy.GetParameterAsText(0)
# Set workspace and environment variables
arcpy.env.workspace = inGDB
arcpy.env.overwriteOutput = True
arcpy.AddMessage("Searching the input workspace now...")
fcList = arcpy.ListFeatureClasses("*", "point")
fcCount = len(fcList)
arcpy.AddMessage("There are {0} layers in the workspace".format(fcCount))
# Set the progressor
arcpy.SetProgressor("step", "Sorting now...", 0, fcCount, 1)
for fc in fcList:
try:
outPath = os.path.join(inGDB + "\\" + fc + "_sorted")
arcpy.Sort_management(fc, outPath, [["ApplicationNumber", "ASCENDING"]])
arcpy.SetProgressorPosition()
arcpy.AddMessage("{0} has been sorted".format(fc))
except:
arcpy.AddMessage("{0} has a problem".format(fc))
arcpy.SetProgressorPosition()
arcpy.AddMessage("Sort is complete.")