Set default value for parameter value in drop-down list

I am trying to create a drop-down list in Dynamo so the user can assign the color for each piece of furniture using a list of items from Excel. The problem is that when the code is run, the list starts at Index 0 and assigns the next value on the list to the next item until it reaches the end of the list and places blanks for the remainder of the items.

I would like to have all the parameter values default at “Select Color” so I can choose which color to assign from the drop-down list.

I’ve tried to nest list, list cycle, lacing, and a few other things to see if I could create a default list that the drop down will reference but it seems like those attempts won’t get the solution.


Any suggestions?

I would look into Data Shapes by @Mostafa_El_Ayoubi. Especially if you are using Dynamo Player. This gives you the ability to get user input via a GUI.

1 Like

Something like this perhaps

Element.SetSharedParameter should be Short Lacing i think

Edit: If the FilePath is variable you could let the user choose the FilePath to.
My graphs aren’t tested. if something doesnt work just reply me.

1 Like

@SeanP, thanks.

@Schasfoortyoeri, thanks for making the example. I’ve tried the solution but the default value doesn’t seem to stick. When lacing is set to shortest for “Element.SetParameterByName”, “Set Value” becomes the only drop down item. If lacing for that same node is set to Auto, the first piece of furniture gets the item at 0, the next one gets 1, and so on…until it reaches end end of the list. Then the rest of the parameter values are left blank.

Could you add a picture of your graph including values?
If you want to pick 1 color for every item you could try with “Count” and “List of Repeated item”.

You could also include the furniture elements in a selection so you can apply them to specific groups only. Then you can use lacing if needed. This may require you to run it a couple times depending on your need.

1 Like

@Schasfoortyoeri, sure thing: image

The ultimate goal is to have the user be able to select one option from up to 60 different options form the drop-down menu. The “Select Color” default value is needed so that the user knows that they need to select a value for the Parameter.

Could you elaborate on running “Count” and “List of Repeated Item”?

@SeanP thanks for that suggestion. Unfortunately, what I’m trying to come up with needs to have Parameter values changed by the user after they click on the element.

I assumed so, but that process you already had figured out and/ or was demonstrated by @Schasfoortyoeri in his previous post.

You can see from my image, the elements and the “color” selection are passed through to the MultipleInputForm node.

You can see on my image the selected values (Color and Elements) are returned for use.

With default value you mean the “Set Value” ? If so, i would take that out and make the list colors only.
You can easy add note’s like i did by using the UI.TextNote (for writing a manual how to use the script for example)

you dont need the list of repeated item and count i suppose, i just tried the script it works…

I chose orange. the lst[0] in the codeblock puts orange on all furniture. It carries the value “Orange” this is what i chose in the userinterface.

I hope this helped. @Ion_Drive else please upload a picture of your graph and where its going wrong.

the Count and List of Repeated item:

basicly you count the list with items and multiply the color with the counted nr of the list.
see below.

@SeanP, I guess I didn’t explain very well what I’m trying to get as I’ve confused both of you.

@Schasfoortyoeri, I got your example to work perfectly for setting a single color on all furniture. …however, I’m trying to set a different color on each individual piece:

image What I’d like to have (but with “Set Value” as the default value before the user assigns the correct value.

image What we currently have

The issue with the drop-down list shown in the first image is that values are “randomly” assigned. One piece of lounge chair (for example) will be assigned Red. Then the next one, Orange. The one after that, Yellow, and so on.

When the end user needs to assign the parameter values from the properties panel, they need to know which parameter values they had assigned and which ones they hadn’t yet, hence the need for either a blank or “Assign Color” to act as the default value before the user makes an appropriate selection.

I really appreciate the assistance.

That image helps A lot. I think what you should be looking at is a Key Schedule of the correct category.

See this link for reference to get you started.