Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top