web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

Random Pin Check

(0) ShareShare
ReportReport
Posted on by

I need to build an app that authenticates users for buying restricted products.  Authorised users have got a 4 digit pin number and when they call we need to ask them for 2 of the 4 digits - how can I get an app to randomly ask for 2 digits eg 1 & 2, 2 & 4 etc for each authorisation.  I'm fine with the checks to see if the numbers match afterwards but I'm a bit lost on ideas for getting it to ask for 2 random digits.

 

Ideas please!  

Categories:
I have the same question (0)
  • vaubeee Profile Picture
    533 on at

    The logic could be:

    "First:" & Mid(*PinFromDatasourceAsText*,RandBetween(1,4),1) & " Second:" & Mid(*PinFromDatasourceAsText*,RandBetween(1,4),1)
     
    But still thinking about how to make sure, it`s not the same ... However, this might get you on track 😉
    ------------------------------------------------------------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.
  • vaubeee Profile Picture
    533 on at
    Maybe this one meets your wish.
    Label2 is the PIN from your datasource as text.
    To avoid duplicates it's always a combined random of digit 1/2 and 3/4
     
    OnStart or OnSelect of a control:
    Set(Random1,RandBetween(1,2));
    Set(Random2,RandBetween(3,4));
    Set(digit1,Mid(Label2,Random1,1));
    Set(digit2,Mid(Label2,Random2,1))
     
    Label for User:
    "Please provide digit " & Random1 & " and digit " & Random2
     
    Evaluate
    "Digit "& Random1 & " is: " & digit1
    "Digit "& Random2 & " is: " & digit2
     
    ------------------------------------------------------------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.
  • JeremyGibbs Profile Picture
    on at

    Thanks @VauBee, will give it a try!  Will confirm when I've tested it.

  • Verified answer
    JeremyGibbs Profile Picture
    on at

    Got there with the following, thanks for the help!

     

    ClearCollect(colPinSelection, Shuffle(Sequence(4)));
    Set(varRandomPin1, First(colPinSelection).Value);
    Set(varRandomPin2, Index(colPinSelection,2).Value)

  • vaubeee Profile Picture
    533 on at

    👍  Thanks for letting me know. Wasn't aware of Shuffle. Great...

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard