cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerAppNewb
Regular Visitor

PowerApp to obtain a value from a list

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

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,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
mdevaney
Super User III
Super User III

@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."

Thank you! 

v-xida-msft
Community Support
Community Support

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,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@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."

@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!

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (70,189)