Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

Incrementing an Alphabetic Field

Avatar

Former Community Member
Is there a way to increment a letter field? That is, on a specific event, change the field to "B" if it is now "A"; change to "C" if it is now "B", etc.

Randy
2 Replies

Avatar

Former Community Member
In JavaScript:



var char = TextField1.rawValue + "";

var asciiCode = char.charCodeAt(0);

var lastChar = "Z"; // Don't let them go past Z



if (asciiCode < lastChar.charCodeAt(0)) {

var nextCode = asciiCode + 1;

TextField1.rawValue = String.fromCharCode(nextCode);

} else {

// Throw error or ignore?

}