populate field with feature class name in modelbuilder

1340
1
08-20-2011 02:20 PM
JimmyDobbins
New Contributor III
Hello,

I am working with modelbuilder to process a large amount of GPS point data. I take GPS points from csv files (each named with their ID number) and string them together to make tracks using the "points to line" tool. Since geodatabase feature classes can't start with numbers, my feature class names look something like "trksp366842960," where MMSI is 366842960, and I want to remove the "trksp."

Right now, I have added a string field to the tracks feature class called MMSI (the vessel ID number) and I wish to populate this field with the right 9 characters of the feature class name. To start, I would be happy to just populate the MMSI field with the full feature class name. When I try using VBScript and Python, nothing is populated (null) no matter how I call the variable in the tool (e.g., %Name% or selecting from the drop-down). Can anyone give me some guidance on how to move forward? When writing an expression in the calculate field tool, I am unsure of the syntax and how to call the Name variable.

Thanks!
Tags (2)
0 Kudos
1 Reply
JimmyDobbins
New Contributor III
Okay, I figured it out...I needed to place the variable name in double quotes as follows:

"%Name%"

To get rid of the trksp in front of the ID number, I used "%Name%"[6:] to get everything from position 6 on.
0 Kudos