String. StartsWith


#1

Hello all - I’m having trouble understanding exactly how “String.StartsWith” node operates.

I have a list of parameters from entities that I want to filter out based on their names.

However doesn’t work as I thought/anticipated.

I really like to see some more documentation on many “esoteric” nodes in Dynamo, because as of now, it’s more like experimentation in order to see how that node behaves.

But until then, I really appreciate if somebody explain simply why the thing I’m doing is not filtering out the list.

Please see attached screen capture.STRING_STARTS_WITH

Help greatly appreciated.

Thanks!


#2

It does work as expected. But you don’t want to use String from Array. If you’re new to Dynamo, the best advice I can give you is to make frequent use of the Watch node or the preview bubbles to actually observe what comes out of each node. That’s how I learned.

StringStartsWithWorkingAsExpected


#3

Hey Adrian,

Personally, I would rather use the Parameter.Name node. Then as the String.StartsWith node only returns booleans, or true/false values, you must make a filter to your original list which is conveniently called List.FilterByBoolMask.

(I’m not sure whether you want the Element.Parameters or the Parameter.Name node as input to the List.Filter??)

In some minutes or hours though, Andreas Dieckmann will come with a way cooler solution! :wink:

3

 

EDIT: and there is Andreas’ answer! :slight_smile:


#4

Andreas & Joisten - thanks for your help!

I do use “Watch” a lot and that is the main tool to learn Dynamo - but sometimes I get lost tweaking solutions.

For example - in Andreas’ solution - I was tempted to feed “str” input in “String.StartWith”, from “String from Object”, and not leave it empty.

So sometimes I get lost on small details like that.

 

Thanks again! - problem solved.


#5

@Andreas - one small note: your solution is not working when select multiple elements.

Selecting “All Elements of Category” instead of “Select Model Element” will not render the expected results.

I guess “String from Object” is the issue.