I'm making a ModelBuilder to facilitate some geographical treatments which concern many CSV files in a same workspace.

For that, I made an iteration on that workspace, it works but I have a problem with the output files' names.

The csv files which are input looks like that : "456789_V1_58412_FTMP_68513_PMSKD.CSV" or "123456_V2_58412_FTMP_68513_PMSKD.CSV" .

For the output names, I need the 9th first characters of the originals CSV files with "Points_" at the beginning. To resume, I need the output names looks like that : "\Défault.gdb\Points_456789_V1" or "\Défault.gdb\Points_123456_V2".

I have made some tests by writing "Points_%Name%" in the output names in my Model builder but the results are not good. I have that :"\Défault.gdb\Points_456789_V1_58412_FTMP_68513_PMSKD" .

I have 2 problems with this : 1 - It doesn't match with what I want to have as a result name 2 - The name is too long for a geodatabase so my names results are heterogeneous

Please, do you have some ideas to help me?

  • Another issue to consider is that geodatabase cannot start with numbers. – ahmadhanb Oct 13 '16 at 8:37
  • Oh yes sorry, I forgot to say that the beginning of my output names start with "Points_" or "Line_". And when I make this : "Points_%Name%" the names are too long . I need that as a final result : "Points_456789_V1". I don't need the rest of the name. – bp03 Oct 13 '16 at 8:44

You need to use Calculate Value model tool. Add one just after your iterator and type in "_".join (%Name%.split ("_")[:2]). Then use Points_%Value%, assuming Calculate Values' output is Value. Don't forget to precondition Value to your create table tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.