Hide a schedule column if it is empty

Hide a schedule column if it is empty

dorer69044
Contributor Contributor
590 Views
6 Replies
Message 1 of 7

Hide a schedule column if it is empty

dorer69044
Contributor
Contributor

I have a schedule in which one column can be empty some of the time and filled some of the time.

For example, that column is "Mark" and I want to implement the following scenario:
1) If all rows have no "Mark" value, then hide it.
2) If one or more rows have a value, show that column.

dorer69044_0-1692699290727.png


I know it can be done with an API.
Manually check each element and show or hide the column based on that information.
Perhaps Revit has a mechanism to skip checking each element?

Thanks for any advice!!!

0 Likes
Accepted solutions (2)
591 Views
6 Replies
Replies (6)
Message 2 of 7

jeremy_tammik
Alumni
Alumni

I am not aware of any non-API functionality to achieve that. Please also note that this discussion forum is dedicated to programming Revit using the Revit API. If you are searching for help to solve your issue manually from an end user point of view without the API, you will probably have more success and address more knowledgeable people for that aspect of things in the non-API Revit product support discussion forums:

  

https://forums.autodesk.com/t5/revit-api-forum/this-forum-is-for-revit-api-programming-questions-not...

  

Best regards,

  

Jeremy

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 7

dorer69044
Contributor
Contributor
Accepted solution

Yes, I need from the API side, but I know a way where I manually check each element.GetParamter("Mark") and based on that information create or not create a column.

But maybe there are already properties for the schedule column or something like that that would help skip that manual work.


About manual I mean:

bool hasValue = false;
foreach (var element in elements) 
{
   var parameterValue = element.GetParameter("Mark")?.AsString;
   if (!string.IsNullOrEmpty(parameterValue))
   {
      hasValue = true;
   }
}



0 Likes
Message 4 of 7

jeremy_tammik
Alumni
Alumni

I suspect the approach you describe is the best way to go. I doubt that Revit has any further-going support for this.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 5 of 7

RPTHOMAS108
Mentor
Mentor
Accepted solution

There isn't always a one to one relationship between rows in a schedule and elements represented in a schedule. In your example the count is one but it could be they are grouped. Depends on aspects such as 'itemise every instance.'

 

I think therefore rather than iterating the elements you should be iterating the schedule rows.

 

You have to check if below forms a solution:

With ScheduleDefinition.IsItemized = false you have the below where if there is a combination of empty and populated cells within a column it will use '<varies>'

This is a localised string but can also be set via

ScheduleField.MultipleValuesCustomText with  ScheduleField.MultipleValuesDisplayType = Custom

 

The text value should be readable via TableView.GetCellText or TableSectionData.GetCellText

RPTHOMAS108_0-1692746184778.png

However you'll have to check this.

 

Message 6 of 7

dorer69044
Contributor
Contributor

Yes, I am familiar with what you described, but in my case the element will always have a unique value.

Also, the various options mean that these columns have some values and I don't need to hide them.


Thanks for the advice.

0 Likes
Message 7 of 7

RPTHOMAS108
Mentor
Mentor

You mean the elements in the schedule you are dealing with have a unique value (itemize all instances).

 

Who is to say what another similar schedule you create for a temporary purpose contains?

0 Likes