Skip to main content
Good afternoon,

 

 

I have this issue come up now and again and I'd like to be able to solve it. But I frequently get excel spreadsheets that neet to be mached to a Point Layer in SDE. Normally I take the geometry of the SDE layer and keep the attributes of the spreadsheet. I normally use the FeatureMerger transformer. My problem is sometimes the number I use to match on is sometimes odd in the spreadsheet such as having trailing zeros or just any number of extra characters (normally 8000+ rows). So question being is there a way to do a "Loose match" on the fields to come up with a match? Thanks!
Hi,

 

 

If you need to ignore all trailing zeros and non-digit characters in the number coming from the spreadsheet, one possible way is to remove them using a StringReplacer with this setting beforehand.

 

-----

 

Test to Match: (.* 1-9])(9^1-9]*)$

 

Replacement Text: \\1

 

Use Regular Expressions: yes

 

 

But it doesn't work for a case where the number coming from the SDE table ends with "0", e.g. "120". If there could be such a case, you will have to think of other approaches.

 

 

Takashi
..i bet he meant leading zero's  
Thanks for the replies. In some instances it would be leading. Since this does not seem to work on SDE what would be the Regex for adding 4 zeros to a 10 digit number so as to modify the excel side? 
Could you please show us some examples of the original string and the preferable result after modifying?
Yes, in this case nearly all the records are 9 to 10 characters long. 3507725552 -> 35077255520000 or 307170548 -> 30717054800000. 
The StringFormatter might help you.

 

Format String: -014s

 

 

The format string means:

 

- the minimum number of characters should be 14

 

- add trailing zeros if the original number of characters is less than 14. 

 

See the help on the StringFormatter to learn more about the fomat string.

 


Thankyou, I can't believe I didn't see this when looking through the transformers. But makes perfect sense. 
A little bit advanced technique.

 

You can also set this expression directly to the "Join On" parameter of the FeatureMerger.

 

-----

 

@Format(%-014s,@Value(the_number_attribute_name))

 

-----

 

 

@Format is one of the FME String Functions, the behavior is almost equivalent to the StringFormatter transformer.

 

String Functions (http://docs.safe.com/fme/html/FME_Transformers/FME_Transformers.htm#transformer_parameters/StringFunctions.htm)

 

 

FYI

Reply