Get key value of element

does anyone know a way to get parameter values from elements that are filled with a keyschedule value.

i get mixed result with the get parametervaluebyname node where some elements give the value and some return the element.

Hi @l.dorrestijn ,

I don’t have a solution on hand for this, could you perhaps share a Revit Project containing a Room which has one of its parameter-values linked to a key schedule?

i already have a work around… but i find it strange that it gives mixed results and was wondering if one should acces these parameter values in a different way.

*edit wrong picture

Hi @l.dorrestijn ,

I think this approach is the way to go. The results you are getting are Revit related since those values are probably saved whilst being dependent on the key schedule.

This code block containing a Code Block might be a bit more elegant though (Assume my elements are your parameter-values):

x.Name == null ? x : x.Name;

PS: What values are you getting from the Element.Name node?

null values from the elements that had a value, the value from elements that returned as element.

my intitial problem is more that half of the rooms give the value with parameter value by name, the other half returns as element.

If you are getting the parameter name correctly after using an Element.Name node I don’t see any issues with your workflow.

@l.dorrestijn ,

thats the first thing that i recognize in your graph… make the right connection

it’s not about the element (room) name, i am trying to get a certain value of the element with the getparametervaluebyname node. but the value of this parameter is from a keyschedule. this results in half of the values are the keyschedule values the other half are elements, probably the element of the keyvalue.

@Daan’s codeblock for getting the element name should work once you have the nodes connected properly. You are correct in that the elements using key parameters return the key element. You just need to get the name of that element now.

@l.dorrestijn ,

can you just snoop your properties…

the strange thing is that all the values i am trying to get are from the same keyschedule.
but half of the returns are the value i am looking for, the other half the element.

It’s likely that you have the same shared parameter (or at least parameter name) for multiple elements. Some of which are controlled by a key parameter and some of which are just filled in manually. You’d have to take a look at one of those elements to confirm, but that’s not uncommon.

I believe Dynamo favors the Parameter from the Key Schedule over the Shared Parameter.

It shouldn’t make a difference. You can only have one of the same parameter per element. It only matters how they were filled out. I’m saying some of your rooms may use the actual key from the key schedule and some may just be manual entry. It’s a completely different object depending on the case (as you can tell with one being a string and one being an element).

@Nick_Boyts

image

When you use the Parameter from the Key Schedule you have to pick a value from that Schedule.
The top Parameter in the image.
The bottom one (same name) is a Project Parameter in this example.

Typing the value of picking the value using the flyout doesn’t make a difference for the
outcome in Dynamo.

Do you have both parameters in your model or is this just an example?

I tried to replicate OP’s ‘issue’. So far no ‘luck’ :stuck_out_tongue_winking_eye:.

So for testing (and b/c of your post) I had both in the Project.

The only time i get the Element [id] is when I wire the Key Schedule Parameter in Element.GetParameterValueByName node.

The only way you should get different values is if there are different parameters (which is bad practice) or multiple ways the parameter is filled out (which is tricky to do for the same category).