Converting object to string for use in String.Contains


#1

Hi, I’m trying to use an Element.ID as string to filter elements in certain Design Options, but fail to convert the object to s string I can use. I need it to be just like a “native” string, like marked in the image below. Anyone know a slick way to do this? Or a better way of isolating elements on Design Options?

2014-11-16_19-58-17


#2

I would recommend using Element.UniqueID since that gives you a string directly. That is, unless you’re using the latest daily build - which doesn’t have that node (https://github.com/DynamoDS/Dynamo/issues/3099). :wink:

 


#3

I’m on latest daily… :frowning: But it seems this will be fixed in next? So no crisis then. Thanks!


#4

If you need the Id as a pure string, I think you could try one of the following:

2014-11-17_100227

  • add a List.FirstItem for an output containing a single item

  • add a List.Map for items containing multiple items


#5

Thanks Dimitar Venkov for your workarounds.

Hello Håvard Vasshaug,

See if you can use below method to get to your results.

Thanks,

Ritesh

StringFromObject