Export elements to Excel issue when 1 or more parameters are completely empty

Hi!
I want to export elements with specific parameters to Excel. However, when none of these elements have the “Optie_Kraan” parameter filled in, I get a null result in FamilyType.Family, causing an error when pushing the result to my List.Create when I get only Null as result with no list. (See image 1)

In image 2, I change 1 element and filled the parameter “Optie_kraan” . Then I get a list with 4 elements back in FamilyType.Family and then everything works perfect!

Maybe to resolve this issue, I can use an “If” node. If all the elements have a null result, I will use Element.GetParameterValueByName to my List.Create (Because when its empty, I still get 4 elements there(see image 1)). If the result is False and one or more elements have a value, I will push the FamilyType.Family to my List.Create instead.

I try some things but seems it doesn’t work… Someone have a simple solution for this?

Thanks!


I solved my problem like that (see image). If someone has a better solution, please shoot :wink:

@Gianni , hi

the topic with “emtyness” is deeper as you think…

i don´t know your contracts… but i would avoid emty values insteat i would establish a optionsets of values that divine emty values like “x”, “ND”,“0”, “0.0”,“None”,…

KR

Andreas

Hi Andreas!

Yes indeed that would be a better solution. I will keep my part as back-up, but I’ll try to avoid the empty values.

Thanks!

Gianni

1 Like