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

Community site session details

Session Id : y2Tak9b+an+OnQzzS65Swz
Power Apps - Building Power Apps
Answered

PowerApp to obtain a value from a list

Like (0) ShareShare
ReportReport
Posted on 21 Jul 2020 23:16:30 by 8

Hi All,

 

Very new to PowerApps and have made this my first project to attempt but just want to hear that something like this is possible. I'm familiar with SharePoint and Office 365 as a platform and I've been asked to move our employee discount code generator from a .net internal form on our old intranet to PowerApps.  

 

It's actually a lot more simple than an actual generator.  I just need to use list of available codes in a list or sql table that we manage and provide one to a user that presses a "Get Code" button in a PowerApp.  Also need to capture the user requesting the code and fill that info in some additional columns in the table or SharePoint list next to the code that was provided.

 

Before diving head first into it, hoping someone can tell me if it's possible.  I've searched quite a bit and haven't found any examples of this specific use case although, I'm pretty sure that it is possible.

 

Thanks in advance!

PowerAppNewb

 

 

Categories:
  • PowerAppNewb Profile Picture
    8 on 22 Jul 2020 at 14:54:20
    Re: PowerApp to obtain a value from a list

    @v-xida-msft 

    I've given this a shot and think I have my button set up correctly but when I add the variable name to the label, it throws an error.

     

     

    Set(
     EmployeeDiscountCode,
     First(
     Shuffle(
     // Filter out these record which has been requested already
     Filter('Employee Discount Codes', IsBlank('Requested By')
     )
     ).Code
    )

     

     

    For the label formula I'm just adding EmployeeDiscountCode but it doesn't seem to be picking it up as a variable.  Also, if I wanted to include the patch statement to add the user requesting it, would you add that to the same formula for the get code button?


    Thanks for all your help!

     

  • mdevaney Profile Picture
    29,987 Moderator on 22 Jul 2020 at 11:36:17
    Re: PowerApp to obtain a value from a list

    @PowerAppNewb 
    The best course of action here is to begin building the app for yourself.  Then for each issue you have when building it post a new question  on the forums.  It is easier to respond to a small question rather than a large one.

     

    Please close this thread if I answered your current question 🙂

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Verified answer
    v-xida-msft Profile Picture
    on 22 Jul 2020 at 03:44:20
    Re: PowerApp to obtain a value from a list

    Hi @PowerAppNewb ,

    Regarding the needs that you mentioned, I think PowerApps canvas app could achieve your needs.

     

    Firstly, you could generate a canvas app based on your SP List or create a canvas app from scratch. Then within the app screen, add a button control, called "Get Code", set the OnSelect property of the "Get Code" button to following:

    Set(
     CodeValue,
     LookUp('Your SP List', FilteredColumn = "xxx").CodeColumn
    )

    The above formula would find the Code value from your SP List based on a specific filter condition, then save it into a variable. You reference the acquired Code value through the CodeValue variable directly.

     

    If you want to choose a Code value from your SP List randomly, I think the Shuffle function could achieve your needs:

    Set(
     CodeValue,
     First(Shuffle('Your SP List')).CodeColumn
    )

    above formula would choose a Code value from your SP list randomly, then save it into a variable.

     

    In addition, if you want to fill some additional columns next to the code value the user is requesting in your SP List, please try the following formula:

    Patch(
     'Your SP List',
     LookUp('Your SP List', CodeColumn = CodeValue),
     {
     AdditonColumn1: User().FullName,
     AdditionColumn2: User().Email,
     ....
     ....
     }
    )

    Patch function

    LookUp function

     

    If you want these Codes which have already been requested not to be requested again, please consider modify above Shuffle formula as below:

    Set(
     CodeValue,
     First(
     Shuffle(
     // Filter out these record which has been requested already
     Filter('Your SP List', IsBlank(AdditionColumn1) && IsBlank(AdditionColumn2) ...)
     )
     ).CodeColumn
    )

     

    Please try above solution, check if it could help in your scenario.

     

    Regards,

  • PowerAppNewb Profile Picture
    8 on 22 Jul 2020 at 00:26:10
    Re: PowerApp to obtain a value from a list

    Thank you! 

  • mdevaney Profile Picture
    29,987 Moderator on 21 Jul 2020 at 23:31:28
    Re: PowerApp to obtain a value from a list

    @PowerAppNewb 

    Yes, it’s definitely possible.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2