Skip to main content
Question

Adding letters as sequential values

  • Oct 2, 2023 10:24 AM UTC
  • 5 replies
  • 111 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

itsmatt
Celebrity
Forum|alt.badge.img+48
  • Celebrity
  • Oct 2, 2023 10:45 AM UTC

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
VIP
Forum|alt.badge.img+63

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+22
  • Influencer
  • Oct 2, 2023 1:57 PM UTC

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
VIP
Forum|alt.badge.img+63

This is a cool solution!

Old computer skills to the rescue! 😂


  • Author
  • Oct 9, 2023 12:15 PM UTC

Thanks for the help all, much appreciated!