# How to filter and set "Key Parameter"?

**URL:** <https://forum.dynamobim.com/t/how-to-filter-and-set-key-parameter/94595>\
**Category:** Developers\
**Created:** [October 16, 2023, 12:50pm UTC](https://forum.dynamobim.com/t/how-to-filter-and-set-key-parameter/94595 "2023-10-16T12:50:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [October 16, 2023, 12:50pm UTC](https://forum.dynamobim.com/t/how-to-filter-and-set-key-parameter/94595/1 "2023-10-16T12:50:09Z")

</div>

Hello,

how do i set a key parameter… i get them via _.AsValueString()_

```auto
import clr
import sys 

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

ODE_GESCHOSSDECKEN = "ODE_Geschossdecken"

#functions
def tolist(x):
    if hasattr(x,' __iter__'): return x
    else: return [x]

#collector
collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Floors)
slabs = tolist(collector.WhereElementIsNotElementType().ToElements())

_fire = [i.LookupParameter(ODE_GESCHOSSDECKEN).AsValueString() for i in slabs]

OUT = slabs, _fire

```

 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/7/57be074e19b3f425437a7b27a195fd7b80d6f6a1.png)  
 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/e/3ea175043f553d51a913b67ea4934301557245d7.png)  
 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/f/efca1ca6fee79c16a0703a72e94a43033b6ded76.png)

tragely my list remains empty

KR

Andreas

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [October 16, 2023, 2:00pm UTC](https://forum.dynamobim.com/t/how-to-filter-and-set-key-parameter/94595/2 "2023-10-16T14:00:59Z")

</div>

Dropdown selections typically use `ElementIds` or numeric indicators. You could always try returning the value using each of the return methods or you could return just the parameter and use a node to get the value and check its object type.

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [October 16, 2023, 2:39pm UTC](https://forum.dynamobim.com/t/how-to-filter-and-set-key-parameter/94595/3 "2023-10-16T14:39:53Z")

</div>

@Nick_Boyts ,

the LookUp showed me that values are not a “format” Value is stored as Element…

I will check… how to set the “Parameter”

KR

Andreas

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [October 16, 2023, 2:45pm UTC](https://forum.dynamobim.com/t/how-to-filter-and-set-key-parameter/94595/4 "2023-10-16T14:45:08Z")

</div>

`AsElement` means `ElementId`. So your best bet in that case is to get the elements (keys) from the key schedule and use that as a kind of lookup. That would depend on how you’re specifying the value to use, but could be name matching, a dictionary, or something similar. Setting a value as an ElementId is the same as any other type. With nodes, that’s the `Element` object itself. With Python and the API, that’s the `ElementId`.
