Skip to main content
Solved

Find and replace string values in index position {0,1}


Hello all,

I am trying to load a data set from an excel file to our organization's Socrata data portal using FME Desktop 2015.1 and have run into an issue with the address field that Socrata uses for geocoding. Some of the addresses in this data set that I am trying to load have addresses like "NE 19TH ST" when the field will only accept valid addresses like "0 NE 19TH ST". I have tried to just find "NE" and replace it with "0 NE" but it tries to replace all the addresses that might have a "NE" in them.

What I would like to do is search in the address field where the first two positions in the string begin with "NE" then where the records start with "NE" I would like to replace that with "0 NE" leaving the rest of the address intact. The end result would ideally look like this: 0 NE 19TH ST

This is a little cumbersome so a more elegant solution is welcome!

Thank you in advance :)

Best answer by takashi

Hi,

Two approaches. Assuming that the attribute name is "address".

StringReplacer (Regular Expression):

Attributes: address
Text to Find: ^(NE.*)
Replacement Text: 0 \1
Use Regular Expressionsyes

AttributeCreator (Conditional Value Setting):

address = 
If @Value(address) Begins_With NE Then "0 @Value(address)"
Else <No Action>

Takashi

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

takashi
Influencer
  • Best Answer
  • December 8, 2015

Hi,

Two approaches. Assuming that the attribute name is "address".

StringReplacer (Regular Expression):

Attributes: address
Text to Find: ^(NE.*)
Replacement Text: 0 \1
Use Regular Expressionsyes

AttributeCreator (Conditional Value Setting):

address = 
If @Value(address) Begins_With NE Then "0 @Value(address)"
Else <No Action>

Takashi


  • Author
  • December 8, 2015

Hi Takashi,

Thank you for your response and suggestions. I have tried both solutions (using the field called "location" instead of "address", I misspoke in the original post) and I am still getting the same error that states, "Value in column "location" uninterpretable as location in input at record ###: "NE 19TH ST..."". Since these solutions did not fix the error I am thinking that this may be a question for Socrata so I will forward this on to them to see what they think.

Thank you again for your help!

Amber


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings