cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Button control to reveal additional columns in canvas app

Hi Power Apps community, 

 

The scenario I am hoping to achieve:
1. User has information about 3 consortium partners and checks the checkbox;

2. User fills in information about Consortium Partner and wishes to add info about Consortium partners 2 and 3

3. User clicks the button to add another data card (Consortium partner #2);

4. User clicks the button one more time to add another data card (Consortium partner #3).

 

I have solved the 1'st one, but having troubles with steps 2-4. Is there a way to make one button to add additional user input options? Attached the screenshot, where the blue button does not yet.. Would sincerely appreciate an advice.

 

Thank you.

 

 
1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

HI @Anonymous ,

I am assuming you have extra fields in your list to cater for the maximum number of additional Partners and you simply want to hide/display the controls as they are required?

If so, set a numeric Variable incrementing each time the button is pushed

UpdateContext({vPartner,vPartner+1})

Then the Visible of all Controls - second one shown

vPartner>0

Then the Height of DataCard (first one)

If(vPartner>0,50,0)  //change 50 to whatever it is now

Then increment the third card to >1 and so on. This will "slide" the cards down as required

Also on the Add button (set this to the limit)

If(
   vPartner>3,    //change as needed
   DisplayMode.Disabled,
   DisplayMode.Edit
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

6 REPLIES 6
WarrenBelz
Super User
Super User

HI @Anonymous ,

I am assuming you have extra fields in your list to cater for the maximum number of additional Partners and you simply want to hide/display the controls as they are required?

If so, set a numeric Variable incrementing each time the button is pushed

UpdateContext({vPartner,vPartner+1})

Then the Visible of all Controls - second one shown

vPartner>0

Then the Height of DataCard (first one)

If(vPartner>0,50,0)  //change 50 to whatever it is now

Then increment the third card to >1 and so on. This will "slide" the cards down as required

Also on the Add button (set this to the limit)

If(
   vPartner>3,    //change as needed
   DisplayMode.Disabled,
   DisplayMode.Edit
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

prajyot
Resolver II
Resolver II

Hello ,
We need to maintain the variable using Set( counter, 1) . Then you need to add the labels and text boxes for consortium 2,3,4 ( 3 labels and 3 text box). On the OnSelect property you need to increase the variable value by 1 and add the condition if ( counter=4,Notify('Can't Add More Consortium'), counter++).
Use the Visible property of each label and text box, mention logic Visible: if ( counter=1, true,false). In this way on every click the counter value is getting increased and the labels/textboxes will be shown or hidden.

You need to mention the same for other labels and textboxes. Make sure you are using the correct counter values for comparing while showing or hiding every label and textbox as well as on button 'OnSelect' property.

**** If required : You need to use another button to remove that textbox 'X' in front of every textbox and use Visible property to show or hide respective textbox and respective label.

Hope this help.

Thanks & Regards,
Prajyot M

Anonymous
Not applicable

@WarrenBelz , yes, this exactly what should be achieved - to hide/display the controls as they are required.

Thank you very much, for your elaborate responses. I am learning how to use this platform. 

 

Perhaps you could clarify a couple of more things:

1. Currently my extra fields have unique Display Names. Is that okay for the solution to work?

2. Should the function UpdateContext be added to the button? Perhaps you could also clarify which property it should define - is it OnSelect?

3. Do I understand correctly that in your example vPartner is the field's Display Name?

Thank you once again.

 

Thanks @Anonymous ,

to answer your questions

1. Currently my extra fields have unique Display Names. Is that okay for the solution to work?

This is irrelevant - you are simply setting Visibility of Controls and Height of Data Cards.

2. Should the function UpdateContext be added to the button? Perhaps you could also clarify which property it should define - is it OnSelect?

Yes - OnSelect - you are incrementing a Variable that will progressively show the cards as its value increases

3. Do I understand correctly that in your example vPartner is the field's Display Name?

No - that is in the Visible property of the Control and the Height property of the Data Card. You can call it what ever you want (as long as it stays the same). It is a Variable. To explain, any property with a true/false option such as Visible can be set with any statement that can only be true or false. so vPartner>0 is either true or false and the control is Visible accordingly. For a better understanding, I am actually saying to the Visible

If(
   vPartner>0,
   true,
   false
)

but you don't need all of that for it to work. The Height of the card is the same - if it "qualifies" to be shown, it is normal Height, otherwise it is zero an cannot be seen. One very important thing - ALL controls in the card need the Visible property, which includes the error, star (you can actually delete these if not used for managing errors) , the label and the text box. Note that you can try making the card not visible only, but I have found at times they "reappear" not where they are supposed to.

Finally (I have posted this example before) - here is what it looks likeExpandCollapse.gif

 

 

 

 

 

 

 

 

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @Anonymous ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Anonymous
Not applicable

Hi @WarrenBelz , 

 

Problem is solved! Thank you very much for our responses!

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!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,667)