Solved! Go to Solution.
Hi,
Thank you, I now understand why I cannot see both the entries for each TOID with a join.
I think I have the answer to your question: the summary cannot work with the null values as null is not automatically assumed to be 0 in a numeric field? - Therefore it would be looking for the min or the max of nothing?
Thanks again,
Liam.
Hi,
I managed to solve the problem: -
I checked for null values throughout the database but the database had none. I then decided to export the table with the join to the same gdb, just called it: 'JOIN2_CarData_RoadLinks'. This made the join 'permanent', my code then whizzed through and completed successfully.
It would appear that you cannot perform comparative VBScripts using the field calculator on a joined table. Or at least my installation won't 🙂
Thanks again for your help, another 'bug' to add to the 'book of workarounds' 😉
Liam.
# -*- coding: utf-8 -*- # --------------------------------------------------------------------------- # testVBScriptCodeBlock.py # Created on: 2013-10-05 12:40:22.00000 # (generated by ArcGIS/ModelBuilder) # Description: # --------------------------------------------------------------------------- # Import arcpy module import arcpy # Local variables: OrientationOfCar = "C:\\Documents and Settings\\rfairhur\\My Documents\\ArcGIS\\Default.gdb\\OrientationOfCar" JOIN_CarData_RoadLinks = "C:\\Documents and Settings\\rfairhur\\My Documents\\ArcGIS\\Default.gdb\\JOIN_CarData_RoadLinks" OrientationOfCar_View = "OrientationOfCar_View" OrientationOfCar_View__3_ = "OrientationOfCar_View" # Process: Make Table View arcpy.MakeTableView_management(OrientationOfCar, OrientationOfCar_View, "", "", "OBJECTID OBJECTID VISIBLE NONE;OrientationOfCar OrientationOfCar VISIBLE NONE;ID ID VISIBLE NONE") # Process: Add Join arcpy.AddJoin_management(OrientationOfCar_View, "ID", JOIN_CarData_RoadLinks, "ID", "KEEP_ALL") # Process: Calculate Field arcpy.CalculateField_management(OrientationOfCar_View__3_, "OrientationOfCar.OrientationOfCar", "CarOrientation", "VB", "Dim CarOrientation\\n\\nDim RoadOrientation\\nRoadOrientation = [JOIN_CarData_RoadLinks.Orientation]\\n\\nDim RoadCompass\\nRoadCompass = [JOIN_CarData_RoadLinks.CompassA]\\n\\nDim RoadCompassMax\\nRoadCompassMax = RoadCompass + 170\\n\\n If RoadCompassMax > 360 Then\\n RoadCompassMax = RoadCompassMax - 360\\n ElseIf RoadCompassMax < 0 Then\\n RoadCompassMax = RoadCompassMax + 360\\n End If\\n\\nDim RoadCompassMin \\nRoadCompassMin = RoadCompass - 170\\n\\n If RoadCompassMin > 360 Then\\n RoadCompassMin = RoadCompassMin - 360\\n ElseIf RoadCompassMax < 0 Then\\n RoadCompassMin = RoadCompassMin + 360\\n End If\\n\\nDim PointBearing\\nPointBearing = [JOIN_CarData_RoadLinks.Bearing]\\n\\nIf PointBearing > RoadCompassMin And PointBearing < RoadCompassMax Then\\n CarOrientation = RoadOrientation\\nEnd if\\n\\nIf PointBearing < RoadCompassMin Or PointBearing > RoadCompassMax Then\\n If RoadOrientation = \"-\" Then\\n CarOrientation = \"+\"\\n End if\\n\\n If RoadOrientation = \"+\" Then\\n CarOrientation = \"-\"\\n End if\\nEnd if ")
The calculation: [RoadLinks.FromTo] = [Stats.FromTo] [RoadLinks.ToFrom] = [Stats.ToFrom] Sample Data: _____________________________________________________________________________ | RoadLinks | Stats | |_____________________________________________________________________________| |TOID FromTo ToFrom | FromTo ToFrom | |_____________________________________________________________________________| |1 null null | 10 null | |2 null null | null 10 | |3 null null | null 5 | |4 null null | null 6 | |5 null null | 3 null | | | |
I've had a look around on the web and I'm sure that the problem is to do with joining an ordinary table to a feature class, but I still have had no luck finding a solution.
Has anyone come across this problem before and found a way around it?
Thanks,
Liam.