Select to view content in your preferred language

Re: Populate fields using python (cumulative)

5933
44
10-14-2015 05:50 AM
TerryGustafson
Frequent Contributor

Ok I think I’m close but need a little more help.  I have a
table like the one attached.  I’m trying to create a line segment from it
that goes from 22.473 to 27.346 but they are on separate lines.  I need a
python script to calculate the to_measure from OBJECTID 1 equal to the
to_measure from OBJECTID2.  Do you think that is possible?

0 Kudos
44 Replies
TerryGustafson
Frequent Contributor

Hang on I think I have it figured out. Sorry to keep buggin you and thanks for the help..

0 Kudos
TerryGustafson
Frequent Contributor

I was wrong I thought that Table to table would work but it still creates the table in memory and then it seems to add all the fields to one record..

0 Kudos
TerryGustafson
Frequent Contributor

I re-read it and I was trying to convert a table and not a table view. Going to try and convert the in memory table to a view and try it again.

0 Kudos
TerryGustafson
Frequent Contributor

Even when I use a table view the output table from the table to table tool does not create the output table correctly.. I think it has to do something with the “Merge Rule” but can’t figure that out.

0 Kudos
TerryGustafson
Frequent Contributor

It appears that the table to table tool does not like when the table is written to a local geodatabase. When I create a .dbf table it copies the data local. Is there something I can add in the script to get it to run on a dbf? When I set the table =”output.dbf” it returns the error it could not find the table “output.dbf”

0 Kudos
JakeSkinner
Esri Esteemed Contributor

You will need to set the full path to where the table is located, beginning with an 'r'.  Ex:

table = r"C:\temp\output.dbf"

TerryGustafson
Frequent Contributor

So if the script is just sitting in the model with no parameters, how does it know when to be executed?

0 Kudos
DanPatterson_Retired
MVP Emeritus

43 replies so far...approaching a record

0 Kudos
TerryGustafson
Frequent Contributor

44.. Thank you..

0 Kudos
JakeSkinner
Esri Esteemed Contributor

You can set a precondition in modelbuilder.  The precondition will mostly like be on the output from the Table to Table tool.