I have one screen in Powerapps which has multiple forms for a Client. Each of these forms are connected to a different CDS entity (table) of information about the same Client. I also have a set of buttons that represent Tabs for the various forms that the user can view/edit. On this one screen, I have Icons in the top banner to represent New, Cancel, and Save fuctions for any of these forms.
I want the OnSelect function of the Buttons(Tabs) to set two variables. One to be used by each form's Visbible property, so that it is the form visible when clicked. But, at the same time, I want to set a second variable that equates to the form name so that, when the user clicks the New/Cancel/Save Icons in the top banner, it will perform the correct action for the correct form.
So far I have tried using 2 Global variables in the OnSelect for the buttons, 2 Context variables, and have tried mixing Global with Context variables. Nothing yet has met the requirement. I either get errors on the buttons or errors on the New/Cancel/Save Icons.
I have included a picture (minus the actual form fields) of the set-up.
Has anyone tried to create the exact same configuration? Am I dealing with a limitation or bug in PowerApps?
Any help is greatly appreciated
No problem with the data source. That's not an issue here.
As for the other point, with a Gallery in place you definitely have less controls to deal with and you can confine your formulas to single areas when needed (much easier to troubleshoot).
Let's imagine for a moment that you have a horizontal Gallery (let's call it galFormSelect) with one button in it. The Items Property of the Gallery might be something like this:
The visible property of each EditForm might be like this.
Contact Form - Visible : (galFormSelect.Selected.ID = 2)
Dues Form - Visible : (galFormSelect.Selected.ID = 3)
The Save control would have a formula similar to this:
This would give you the same functionality just with a Gallery as your control. If you're using button in your Gallery, you don't even need to put any formulas in it. It will automatically have Select(Parent) which will do the "selected" for you and meet all the other formulas.
I hope that is clear and helpful. Post back if you have more questions.
I have replaced the buttons with a gallery, and totally see your point. It's working with my IF statements on the Control, but I will change it to the Switch function you have illustrated.
Thanks for all your help Randy. You've been great.
No problem! Yes, If statements will work, but I personally find a Switch statement to be much cleaner and easier to diagnose and read.
Good luck with the rest and definitely post back if you have issues.
Learn how to create your own user groups today!
Check out the new Power Platform Community Connections gallery!
Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.