Skip to main content
Solved

Alphanumeric filtering AA,AB,BA etc best approach


Ok folks this might be an interesting one.

I have data that is tagged with two character ID AA with all variations through to ZZ. That's 678 combinations. I need to act on each combination individually.

Initially I thought of using a attribute filter and importing the 678 combinations which worked bu the down stream handling is a killer. Not to mention making the workspace bloated.

I then thought of making a first character filter an then passing that to second character filter. However that the same problem in two dimensions.

1 first character filter each passing to a second filter for the second character however the net result is the same number of individual output ports.

Each letter represents a coodinate in essence in a 26 x 26 grid.

The final goal is to get the X and Y coordinate pair. AA = 1,1 ZZ = 26,26.

These X and Y coordinates would be used as Offseter parameters for object placement.

Anybody got any clever ideas how I might handle this?

Thanks folks.

Best answer by takashi

Hi @andyew, the character codes of uppercase English alphabets are sequential numbers starting with 65, and the CharacterCodeExtractor transformer can be used to extract the character code of the first character in the specified string. Therefore, this workflow would work for you.

0684Q00000ArKaFQAV.png

Alternatively, FME String functions can also be used like this.

0684Q00000ArKeGQAV.png

X = @FindString(#ABCDEFGHIJKLMNOPQRSTUVWXYZ,@Substring(@Value(ID),0,1))
Y = @FindString(#ABCDEFGHIJKLMNOPQRSTUVWXYZ,@Substring(@Value(ID),1,1))

See here to learn more about FME String functions: String Functions

View original
Did this help you find an answer to your question?

2 replies

takashi
Supporter
  • Best Answer
  • October 23, 2017

Hi @andyew, the character codes of uppercase English alphabets are sequential numbers starting with 65, and the CharacterCodeExtractor transformer can be used to extract the character code of the first character in the specified string. Therefore, this workflow would work for you.

0684Q00000ArKaFQAV.png

Alternatively, FME String functions can also be used like this.

0684Q00000ArKeGQAV.png

X = @FindString(#ABCDEFGHIJKLMNOPQRSTUVWXYZ,@Substring(@Value(ID),0,1))
Y = @FindString(#ABCDEFGHIJKLMNOPQRSTUVWXYZ,@Substring(@Value(ID),1,1))

See here to learn more about FME String functions: String Functions


  • Author
  • October 23, 2017
takashi wrote:

Hi @andyew, the character codes of uppercase English alphabets are sequential numbers starting with 65, and the CharacterCodeExtractor transformer can be used to extract the character code of the first character in the specified string. Therefore, this workflow would work for you.

0684Q00000ArKaFQAV.png

Alternatively, FME String functions can also be used like this.

0684Q00000ArKeGQAV.png

X = @FindString(#ABCDEFGHIJKLMNOPQRSTUVWXYZ,@Substring(@Value(ID),0,1))
Y = @FindString(#ABCDEFGHIJKLMNOPQRSTUVWXYZ,@Substring(@Value(ID),1,1))

See here to learn more about FME String functions: String Functions

That's brilliant @takashi. I started thinking there had to be a string calculator involved. Ironically I used similar operators in Excel to create my list of filters.

 


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