cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JRuss
Helper II
Helper II

Form height doesn't collapse when using context variable

I have had some success with setting form heights dynamically by using IF statements.  An example would be:

If(DataCardValue165.Value=true,
'Customer_Type_DataCard2'.Height+'APR_DataCard2'.Height+'Market_Focus_DataCard2'.Height+'Discount_Classes_DataCard2'.Height+5
,0)

In this scenario, there is a toggle, that when switched to "Yes" displays the form panel, and when switched to "No" hides the form panel, as the height is changed to 0.  There are some scenarios where certain data cards are removed from visibility. For these, I change the visibility of the objects inside the card to 0, and I change the height of the data card to 0, and the form resizes itself as expected.  For the most part.

Sometimes these forms don't always expand and contract perfectly, at least while working in the editor, and scroll bars become visible.  But generally this method works mostly ok in playback mode or when published and played in the browser.  Not 100%, but kinda works.

I needed to hide some data cards with buttons, so I used a context variable.  This works.  But now the form in question no longer contracts to a shorter length when the fields are hidden using the variable.  So the dynamic form resizing works with the IF statements, but doesn't work with the context variable.  Please see screenshots.  And thanks!

Power-Apps-Community_01_2021-11-16_12-38-30.pngPower-Apps-Community_02_2021-11-16_12-39-39.pngPower-Apps-Community_03_2021-11-16_12-40-34.pngPower-Apps-Community_04_2021-11-16_12-41-08.pngPower-Apps-Community_05_2021-11-16_12-43-13.pngPower-Apps-Community_06_2021-11-16_12-51-53.png

2 REPLIES 2
StalinPonnusamy
Super User
Super User

Hi @JRuss 

 

I assume you are setting the visible property of the Card, not the controls. In general, we don't need to adjust the height of the control. Only change the visible property of the card.

 

StalinPonnusamy_1-1637102852103.png

 

And also you have to use a Scrollable screen

StalinPonnusamy_0-1637102818297.png

 

We have a similar scenario with one of our current projects and the above works charmly. We have very complex logic to enable control.


Thanks,
Stalin - Learn To Illuminate

Hi @StalinPonnusamy,

We are conditionally setting the visibility of the objects inside the card (StarVisible, DataCardKey, ErrorMessage, DataCardValue) and conditionally setting the height of the card itself, in order to make the cards "disappear" conditionally.  And yep, using a scrollable screen.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,849)