cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alex-W
Helper II
Helper II

Auto Arrange Labels

Is there a way to auto arrange labels on a screen based on the visibility settings of other labels? 

For example, I have four labels arranged horizontally on a screen.  Each label has a visible setting that says hide the label if it is blank.  So if labels two and three are blank, then only labels one and four are visible.  The issue I have with this is that there is a huge space between labels one and four in this scenario.  Is there a way to have label four move to the second label's position if it is not visible?

 

  

  

1 ACCEPTED SOLUTION

Accepted Solutions
Alex-W
Helper II
Helper II

@poweractivate The If statement on the X property is where the magic happens.  I did not write the X property like you did.  Instead, on the personal email label I wrote it as X = If(LblOfficeCell.Visible=false, Xvalue1, Xvalue2).   Xvalue1 is where I want the personal email label to be if office cell is blank.  If not, stay at Xvalue2.  

 

This is the basic setup for the If statement on the X property.  I have to update it to take into consideration the other labels and whether or not they are visible.  

View solution in original post

9 REPLIES 9
Nogueira1306
Super User
Super User

Not sure what you are trying to do..
But, you can create a collection with the text from the labels and remove/add the text (from the labels) tha tyou want.

In that screen tha tyou show the labels, you insert a gallery and the datasource will be that collection.

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,

Gonçalo Nogueira

Check my LinkedIn!

My website!

My blog!

@Alex-W 

 

It looks like the gap isn't there unless there are more columns than there are fields.

Right now I don't know a better way than this.

1. Increase the column count to the maximum of 12.

2. Only put a maximum of up to 12 fields, or use less than 12 fields.

3. Turn off snap to columns.

4. Resize the control to be smaller than all of the datacards can fit in one row, and try to resize each datacard manually so it looks the way you want.

5. Setting visible to off on one DataCard should now auto arrange them.

6. For more than 12 columns on a single data source, I know of no better way than to make another Form and then have that also set to 12 columns as well, and put 12 columns or less again on it. If you do this, you may have to not use SubmitForm and instead start using Patch on the Submit button and then take the result of both Forms into account in the Patch to the Data Source.

 

Besides the above, I do not know of a better way currently, because it looks like it does not do what you want any other simple way as far as I know.

 

Check if above helps @Alex-W 

 

Alex-W
Helper II
Helper II

I don't think I explained this properly.  So I created an image to illustrate the issue I have.  This is on a gallery that is displaying data from the SharePoint list.  The columns are office phone (O:) , cell phone (C:), official email (@1:), and personal email (@2).  If all fields have data, the gallery displays the row nicely, but if cell phone and official email are not entered the gallery only displays the office phone and the personal email fields with a gap between them.  Is it possible to have the personal email field automatically move to the cell phone XY position if the cell phone and official email fields are blank and not visible?

 

Screen Shot 2022-10-07 at 10.46.23 AM.png

 

 

@Alex-W No I think I understood it correctly. The only way I know of is the way I gave in my response. Unfortunately, I do not know another way.

Alex-W
Helper II
Helper II

@poweractivate thanks for trying to help but I am pretty sure your solution is for a form and not a gallery.  

@Alex-W You could modify the XY position and size by using an If to check if they are blank.

So for the Width and Position X,

use something like

 

Width property:

If(IsBlank(ThisItem.YourColumn),0,300)

 

X property:

If(IsBlank(ThisItem.YourColumn),someXIfBlank,SomeXIfNotBlank)

 

I am not aware of any way to do this automatically. Since you have just one row, and just a few fields, maybe this is possible. It is not ideal to do it like this, since you have to check other fields Blank or not on the other fields themselves. If there are too many fields to do this kind of check on, this gets unmaintainable fast. But for this case, maybe it just might work.

 

 

 

Alex-W
Helper II
Helper II

@poweractivate The If statement on the X property is where the magic happens.  I did not write the X property like you did.  Instead, on the personal email label I wrote it as X = If(LblOfficeCell.Visible=false, Xvalue1, Xvalue2).   Xvalue1 is where I want the personal email label to be if office cell is blank.  If not, stay at Xvalue2.  

 

This is the basic setup for the If statement on the X property.  I have to update it to take into consideration the other labels and whether or not they are visible.  


@Alex-W wrote:

I have to update it to take into consideration the other labels and whether or not they are visible.  


Yes, you do, and the more there are, the more nesting, the more "visible/not visible" states you have to consider and possible positions. For more than 3 or 4 fields (and even for that many), it is a bit unmaintainable, but I am not sure of another way. Since you have just few fields, maybe it's not too bad. 

Alex-W
Helper II
Helper II

@poweractivate Everyone has an office number so I only have to create the If statements for the official email and personal email labels.  

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,377)