Solved

Alphanumeric filtering AA,AB,BA etc best approach

  • 23 October 2017
  • 2 replies
  • 5 views

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.

icon

Best answer by takashi 23 October 2017, 05:24

View original

2 replies

Userlevel 2
Badge +17

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

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.

 

Reply