cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lmheimendinger
Resolver III
Resolver III

Button onselect from SharePoint

I believed I had devised a most clever solution to a problem to create a variable list of actions to run other apps based on the user's shared permissions.  I created a SharePoint list with two columns, button text and button action.  The action columns all contained the text "Launc(...)" to run the corresponding Power Apps.  

 

In the app I have questions about, I did a ClearCollect() on the list filtering it as needed. I then created a gallery using the collection and in the first row added a button.  I set text property to ThisItem.ButtonName and the OnSelect property to ThisItem.ButtonAction. The resulting gallery looks great.

 

But clicking on the buttons does nothing.  To verify the action i created a button outside the gallery and pasted the column VALUE from one of the rowsd for OnSelect propery, and of couse it worked perfectly. I tried some other values beside Launch() and none worked.

 

If anyone knows how to make the OnSelect work with a data value instead of a direct comand it would be awesome to find out.  If this is just not something that will ever work, equally valuable to know, so thanks in advance for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@lmheimendinger 

You cannot refer to text as actions, formulas or data in PowerApps.  They must be declared in the app.

So what you are attempting is not going to work!

 

PowerApps builds a complete script of the app in order for it to run. This is done in the designer.  The Formula Editor in the designer will not allow errors, so when the app is all done, what the editor has determined would work, will work.  What it found in error, will do nothing.

If you were to inject "text" as the formula you want to evaluate in your OnSelect action, then how would PowerApps know it was a functional formula?  That would only be determined at design-time.

 

You can, however, create actionable items in your list and then place a formula in your OnSelect to determine the actions to really take based on the value it reads from the list.  That all works perfectly.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@lmheimendinger 

You cannot refer to text as actions, formulas or data in PowerApps.  They must be declared in the app.

So what you are attempting is not going to work!

 

PowerApps builds a complete script of the app in order for it to run. This is done in the designer.  The Formula Editor in the designer will not allow errors, so when the app is all done, what the editor has determined would work, will work.  What it found in error, will do nothing.

If you were to inject "text" as the formula you want to evaluate in your OnSelect action, then how would PowerApps know it was a functional formula?  That would only be determined at design-time.

 

You can, however, create actionable items in your list and then place a formula in your OnSelect to determine the actions to really take based on the value it reads from the list.  That all works perfectly.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hmmm, while that approach does not offer the flexabilityI hoped for, I might be able to craft something around it.  I appreciate the perspective though and wish this might be implemented in the future: resolve at runtime and throw an error if invalid.

RandyHayes
Super User
Super User

@lmheimendinger 

Yeah, doesn't happen with PowerApps.  If it was a development environment I could see it, but there is not real error handling and such to speak of in the way that you would in a dev platform.

PowerApps is highly declarative.  It is built around Excel...everything is formulas.  And, just like in Excel, you can't use text to declare a formula (indirect).

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,511)