Skip to main content
Question

Adding letters as sequential values

  • October 2, 2023
  • 5 replies
  • 35 views

Relative beginner here! I'm trying to set up a workbench so it can take features, assign them groups and then assign sequential values per feature in a group. The Counter transformer does the first part but I need help with the second part. I've used the StatisticsCalculator transformer which adds sequential numbers but is there a way to add letters (e.g. a, b, c... and so on)? Or is there a way to do this in the text editor?

 

Thanks for any help!

5 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • 2000 replies
  • October 2, 2023

You could use an AttributeValueMapper to map 0>a, 1>b etc

 

imageI don't know of any tools out of the box which would do this


redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3700 replies
  • October 2, 2023

This may vary based on encoding but...

 

You can use a ModuloCounter, set to max 26, and a CharacterCodeReplacer, in the standard ASCII set uppercase letters start go from 65 (A) to 90 (Z), lowercase ones from 97 (a) to 122 (z). So in your example, @Value(modulocount)+65 or @Value(modulocount)+97 would do the trick.


joepk
Influencer
Forum|alt.badge.img+20
  • Influencer
  • 144 replies
  • October 2, 2023

This may vary based on encoding but...

 

You can use a ModuloCounter, set to max 26, and a CharacterCodeReplacer, in the standard ASCII set uppercase letters start go from 65 (A) to 90 (Z), lowercase ones from 97 (a) to 122 (z). So in your example, @Value(modulocount)+65 or @Value(modulocount)+97 would do the trick.

This is a cool solution!


redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3700 replies
  • October 2, 2023

This is a cool solution!

Old computer skills to the rescue! 😂


  • Author
  • 1 reply
  • October 9, 2023

Thanks for the help all, much appreciated!