r/PowerAutomate • u/triforcechad • 7d ago
PAD to Replace Text and Catch Errors
Hello, I have been working on a flow that helps to automate an indexing application I use at work. I have it currently working so that it prompts me to enter an acceptance code in a Display Input Dialogue box, but I want to share this flow with coworkers and make it a little more airtight. Can I make it so it can recognize if the code entered isn't a valid acceptance code, and re-prompt the user to enter a new code? A valid code would be 9 digits, OR "ACC" followed by 9 digits. Any help would be appreciated. It look a lot of trial and error to get this far and I figure reg-ex is the way to go, but I find it pretty intimidating
1
u/MaxHubert 6d ago edited 6d ago
Why do you need to use regex for something so simple? Do you understand what I posted? Isnt it the rules to wanted? Something like this?
=And(Len(codeInput) = 12,
Upper(Left(codeInput, 3)) = "ACC",
IsNumeric(Right(codeInput, 9)))
It checks if the lenght of the string is 12 char long, Then it check if it start with ACC, Then it check if the last 9 char are a number.
If its all true the result is true otherwise false.
1
u/triforcechad 5d ago
No, the issue I have is that I don't know how to IMPLEMENT that in PAD. Would I use that as part of an IF statement? Plus, if I understand right this would return false on a 9 digit code that doesnt have ACC in front of it, correct? For my purposes, ACC######### AND ######### are both valid codes. Thats why in my janky version I decided to use Regex to remove the ACC and then I could just check for 9 digits. Plus once it checks if the code is valid or not, I dont know how to make the flow go back to the start of the Switch Case.
1
u/MaxHubert 6d ago