POST
|
Thank you so much Xander!!! It works! Happy new year to you
... View more
01-06-2015
06:44 AM
|
0
|
1
|
975
|
POST
|
Hi smart people!! I have created a script to automate our workflow at work but have been having difficulty with my optional parameter. I've googled every possible help i could get with this but nothing so far... Please see below the script: # Import all necessary modules import os, sys, arcpy from arcpy import env import getpass # Define all objects to be used sde_conn = "S:/Projects/Oilsands/FortHills/OS0101_Fort_Hills_MPG/010_FH_GDA/002-GDA_LOG/My_ArcSDE_Conn.sde" outpath = sde_conn + "/" gdaFC = "FORTHILLS.GDA_PERMIT_BOUNDARY_A" arcpy.AddMessage("SDE Connection Successful") # Prompt for user parameters table = arcpy.GetParameterAsText(0) field = arcpy.GetParameterAsText(1) gdanum = arcpy.GetParameterAsText(2) extstart = arcpy.GetParameter(3) extend = arcpy.GetParameter(4) extdue = arcpy.GetParameter(5) asbsubmit = arcpy.GetParameter(6) # Optional Parameter arcpy.SetParameter(3, gdanum) # Specify selection whereClause = '"GDA_NUMBER"' + " = '" + str(gdanum) + "'" # Updates information of gda feature class try: cursor = arcpy.UpdateCursor(outpath + gdaFC, whereClause) for row in cursor: row.setValue("EXTENSION_START_DATE", extstart) row.setValue("EXTENSION_FINISH_DATE", extend) row.setValue("EXTENSION_DUE_DATE", extdue) row.setValue("ASBUILT_SUBMIT_DATE", asbsubmit) # Script should skip this if no value entered row.setValue("STATUS", "E") row.setValue("INTERNAL_ROW_CHANGED_DATE", time.strftime("%x %X", time.localtime())) row.setValue("INTERNAL_ROW_CHANGED_BY", getpass.getuser().upper()) cursor.updateRow(row) del cursor, row except: print arcpy.GetMessages(1) arcpy.AddMessage("GDA has been extended")
... View more
01-03-2015
11:41 AM
|
0
|
3
|
6549
|
POST
|
Thanks for the too Xander. You are the smartest!!! Sent from my iPhone
... View more
09-29-2014
02:14 PM
|
1
|
0
|
221
|
POST
|
I have a table / feature class that has the due dates populated. Is there a way for the system to automatically populate a new column i have added named "status"? It should just look at the Due Date Column and compare it with the Current Date (Now()).
... View more
09-27-2014
04:14 PM
|
0
|
3
|
2608
|
POST
|
Hi. Here is the code: # Import all necessary modules import os, sys, arcpy from arcpy import env outpath = "C:/Users/ssantos/Desktop/Overarching/Vector/TEMP.gdb/" # Get the information you need to populate temporary table a = arcpy.GetParameterAsText(0).upper() b = arcpy.GetParameterAsText(1).upper() c = arcpy.GetParameterAsText(2) d = arcpy.GetParameterAsText(3).upper() e = arcpy.GetParameterAsText(4) f = arcpy.GetParameterAsText(5).upper() g = arcpy.GetParameterAsText(6).upper() h = arcpy.GetParameter(7) i = arcpy.GetParameter(8) j = arcpy.GetParameter(9) k = arcpy.GetParameter(10) l = arcpy.GetParameter(11) m = arcpy.GetParameter(12) n = arcpy.GetParameterAsText(13) o = arcpy.GetParameterAsText(14) # Create insert cursor for temporary table rows = arcpy.InsertCursor(outpath + "temptbl","") #Inserts a row into the table try: for x in xrange(1,2): row = rows.newRow() row.setValue("GDA_FORM_NUMBER", a) row.setValue("JOB_COORDINATOR", b) row.setValue("JC_PHONE_NUMBER", c) row.setValue("SUPERVISOR", d) row.setValue("SR_PHONE_NUMBER", e) row.setValue("CONTRACTOR", f) row.setValue("PLANT_AREA", g) row.setValue("ESTIMATED_START", h) row.setValue("ESTIMATED_END", i) row.setValue("GDA_DUE_DATE", j) row.setValue("CENTER_X_COORD", k) row.setValue("CENTER_Y_COORD", l) row.setValue("WORKAREA", m) row.setValue("CLOSED", n) row.setValue("DESCRIPTION", o) row.setValue("EXTERNAL_SOURCE", "GDA PERMIT TABLE") row.setValue("EXTERNAL_SOURCE_DOCUMENT", "GDA FORM") row.setValue("INTERNAL_ROW_CREATED_DATE", time.strftime("%x %X", time.localtime())) row.setValue("INTERNAL_ROW_CREATED_BY", userName()) row.setValue("INTERNAL_ACTIVE_IND","Y") rows.insertRow(row) except: print arcpy.GetMessages(1) # Delete cursor and row objects to remove locks on the data del row del rows
... View more
08-02-2014
05:47 AM
|
0
|
2
|
421
|
POST
|
Hi, i am trying to use row.setValue to set the field value of my username column to my username. Is there another way i can automate this with python as my code below is not working: row.setValue("INTERNAL_ROW_CREATED_BY", userName())
... View more
08-01-2014
04:40 PM
|
0
|
6
|
3437
|
Title | Kudos | Posted |
---|---|---|
1 | 09-29-2014 02:14 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|