cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kubo
Frequent Visitor

store Form in variable?

Hello,

 

is there way to store different forms in variable?

 

I have multiple forms on the same screen and showing only one at the time. The buttons to control the forms are the same however. I need to know which Form is currently visible/edited.

 

I have tried this:

Set(varCurrentForm, Form1)

However as soon as I put:

Set(varCurrentForm, Form2)

 

I will get incompatible error.

 

Is there any way I can store current form in variable and use it this way for example varCurrentForm.Unsaved?

 

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User
Super User

You can try this:

If(Form1.Visible,SubmitForm(Form1),SubmitForm(Form2))

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Consider Checking My Youtube Channel

 

View solution in original post

4 REPLIES 4
eka24
Super User
Super User

On the OnSelect of the Button create a Variable:

     UpdateContext({varShow:!varShow})

In the visible property of Form1: varShow


In the visible property of Form2: !varShow

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Consider Checking My Youtube Channel

Kubo
Frequent Visitor

Hi @eka24,

 

Thanks for the answer.

 

I don't have issue with setting visibility to the forms. My problem is that for example I have submit button. For submitting I need to know which form is visible. 

 

I would like to do something like:

Submitform(varCurrentForm)

 but I cannot store current store in variable as it gives incompatible error unfortunately. 

 

Same situation is when navigating away from the form, I would like to check if current form is unsaved varCurrentFrom.unsaved but I need to store form in variable and than later reference it. 

eka24
Super User
Super User

You can try this:

If(Form1.Visible,SubmitForm(Form1),SubmitForm(Form2))

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Consider Checking My Youtube Channel

 

View solution in original post

Kubo
Frequent Visitor

Thank you @eka24 , I will need to go with this or maybe have different screens for each form witch I wanted to avoid. 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,318)