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
Thanks,
Steve
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:
Table(
{btn:"General", ID:1},
{btn:"Contact", ID:2},
{btn:"Dues", ID:3},
{btn:"Appointment",ID:4},
{btn:"Matters", ID:5},
{btn:"Communication", ID:6},
{btn:"Academic", ID:7},
{btn:"Salary", ID:8}
)
The visible property of each EditForm might be like this.
Contact Form - Visible : (galFormSelect.Selected.ID = 2)
Dues Form - Visible : (galFormSelect.Selected.ID = 3)
etc...
The Save control would have a formula similar to this:
Switch(galFormSelect.Selected.ID,
1, SubmitForm(GeneralForm),
2, SubmitForm(ContactForm),
3, SubmitForm(DuesForm),
4, SubmitForm(AppointmentForm),
5, SubmitForm(MattersForm),
6, SubmitForm(CommunicationForm),
7, SubmitForm(AcademicForm),
8, SubmitForm(SalaryForm)
)
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.
/Steve
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.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
255 | |
127 | |
85 | |
84 | |
67 |