Hi,
I have a value like APPIAN123, need to display the output as APPIAN321
Guide me
Discussion posts and replies are publicly visible
Hi, can you confirm the last number digit will be fixed all time or not?
hi puneet,
ya, it is fixed
It depends on what the rules are here governing the format of the value you're referencing:
Hi stewart,
- The whole length is not fixed, but the length of the number is the same(3)
- Text is always A thru Z
You can try something like this -
a!localVariables( local!a: "APPIAN123", local!numberList: touniformstring({ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }), local!length: len(local!a), local!lengthArray: enumerate(local!length) + 1, /* Get all the letters array */ local!lettersArray: a!forEach( items: local!lengthArray, expression: a!localVariables( local!item: index(local!a, fv!item, ""), if( contains(local!numberList, local!item), null, local!item ) ) ), local!lettersLength: length(local!lettersArray), /* Get all the numbers array */ local!numbersArray: a!forEach( items: local!lengthArray, expression: a!localVariables( local!item: index(local!a, fv!item, ""), if( contains(local!numberList, local!item), local!item, null ) ) ), local!numbersLength: length(local!numbersArray), /* Get final output */ local!actualLetters: concat( rdrop(local!lettersArray, local!numbersLength) ), local!actualNumbersArray: ldrop(local!numbersArray, local!lettersLength), local!actualNumbersReverse: concat(reverse(local!actualNumbersArray)), concat( local!actualLetters, local!actualNumbersReverse ))
Ok, so this is pretty straightforward. let's break it down into a smaller set of problems:
hopefully that'll give you a direction to solve this for yourself