1

My company uses an alpha-numeric substitution function. For example, say 1=A, 2=B, 3=C ... 8=H, 9=I and 0=J. They then convert a date in international format (DDMMYY) using the substitution so that a date of "311218" (Dec. 31, 2018) would convert to CAABAH.

In a traditional programming environment, I would use a FOR loop and loop through the 6 digits of the numeric date to compare each digit against a CASE statement or something similar. With each loop, I would add the character substitution to a variable and build out the new value until I got all 6 letters.

Not sure how to accomplish this with PowerApps though. Any ideas would be greatly welcome...

@Mike2500 - you have been a wealth of great ideas. Any thoughts?

  • Thanks for the compliment, though while I did see your post, apparently tagging doesn't work here in this platform – Mike2500 Feb 5 at 20:23
1

One method is just a bunch of nested substitute functions. It's not a graceful solution, but it should work. If you go this route, I'd recommend adding an apology to your docs for whomever takes over this app. But, this may be the only supported way at this time. We have regex, but only the ability to match, not replace. While we have a char function to work with ascii values, we don't have an asc function to go the other way. So, like this, but with more nesting:

Substitute(Substitute(Substitute("311218","1","A"),"2","B"),"3","C")

Other options include calling an azure function, or perhaps with Flow if you don't mind the replacement happening as part of a workflow. Of course, both of these make the replacement simpler at a cost of higher application complexity of calling the other services.

  • Not exactly an elegant solution, but it works! Thanks, @Mike2500 – gpence Feb 5 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.