1

The expression usedModel 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?
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'

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.