1

The expression used Model runs and removes spaces but not apostrophes

I am trying to run a model on a dataset, and in doing so I create new features from the input spreadsheet. The NAME_SHIP field is being used to create the names of the new feature classes but the field is set up with illegal characters. I am already using one CALCULATE VALUE tool in my model but found that some of the ship names also include an " ' " (apostrophe) in them. Is there a way to either:

  1. Include an expression in the already existing CALCULATE VALUE to rid the names of the apostrophe? or
    1. Where do I insert another CALCULATE VALUE tool in the model to fix for both issues while creating a new FC?
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Jun 3, 2016 at 14:26

1 Answer 1

2

This can be easily done in the same calculate tool so no need to add another tool.

If you think about it what does a replace function return? A string! Which you can put through another function!

Here is a silly example were ww would be your %Value%

ww = "Wwww 23'rrr"
ww.replace(" ","").replace("'","_")

returns

'Wwww23_rrr'
answered Jun 3, 2016 at 17:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.