Element get parameter value by parameter id

Is there a node (or a way to code) a version of Element.GetParameterValueByName that accepts parameter id’s instead?

Situation: We have projects that have duplicating project parameters, and have for many versions. We haven’t been able to root out the cause of the duplication’s, so in the interim we want to delete the extra parameters. I have a working version of the script, but am rewriting it to handle fringe cases. I need the value of each copy of the project parameter. I can’t use Element.GetParameterValueByName because it returns only the first one, and I have no control over which parameter.id is being retrieved. While I’ve found a work around it is clunky (run Element.Parameters on the elements, extract the Parameter.Id, filter that list by the parameters I need, and then retrieve the nodes).

My recollection is that copy/paste between projects or otherwise moving stuff between models will create this issue if you haven’t properly created the parameters in your template. New parameter means new GUID means it’s not the same so duplicate the value.

Note that it is possible to ‘consolodate’ values to a single parameter and delete the duplicates via Dynamo. I do not have a graph to share though.

Some nodes/library search terms to look into:

  • Element.Parameters
  • Parameter.Id
  • ==
  • List.FilterByBoolMask
  • Parameter.SetValue

We know they are coming from certain tasks, we just haven’t been able to pin down what tasks/elements cause it to happen, and which parameters duplicate varies. I can get the content, I’m just trying to streamline the graph. I have to keep a specific version of the parameter to make sure that schedules remain intact.