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.
Solved! Go to Solution.
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.
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.
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.
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).
User | Count |
---|---|
258 | |
111 | |
95 | |
48 | |
41 |