Where LVAR1 is a local variable pointing to your widget with some text on it–your “input” widget.
This takes the first character of the text value (via .charcodeAt(0) ). So if the widget has “A” or “Albert” it works the same, taking only “A”.
You could replace LVAR1 with the name of a global variable if you want.
Where OnLoadVariable is the default built-in global variable in Axure.
You could insert the name of any global variable you’ve set up.
So, that’s the closest I could get to a “simple fix” but it’s not that simple and while it works, it is a hack and not officially supported, so use at your own risk.
Now, Axure also does not support string arrays which would be an “old school” method for this problem. But, it can be faked pretty well in this simple case. Here’s the approach:
Create a global variable with the alphabet as its default value (or set it via Loaded or Page Loaded events). I added this to my demo file to make a default string value for a new global variable named CharArray:
Then use some Axure string functions to get the next character in the alphabet string:
Find the position (index) of your input character (e.g., ‘a’) in CharArray with the .indexOf() function in this Axure expression: [[CharArray.indexOf('a')]] --this would return 0 (zero) as ‘a’ is the first character and the index starts at 0. So ‘b’ would have an index of 1 and ‘z’ would be 25.
Extract the next character from the string with the .substr() function: [[CharArray.substr(N+1, 1)]] (where N is the index of your input char.)
You can “chain” these functions together in one elegant line of Axure code (again, where LVAR1 points to your input widget or character):
myWidget to “[[CharArray.substr(CharArray.indexOf(LVAR1)+1, 1)]]”
So, that’s my “pure uncut Axure secret sauce” solution. I improved it a bit by handling lowercase and uppercase letters (inspect the Interaction code for the “Next Letter” button) and error handling for “non letters”.
You could also include digits in the default value for CharArray, which seems silly, but would give you one consistent way to handle alphanumeric “advancing” --so ‘1’ would convert to ‘2’ in same way that ‘A’ would convert to ‘B’. Make sense?