Linking Two Instance Parameters/Parameter Values

Hello everyone.
I’m trying to create a database for item instances of a certain family, so that some specific parameters would show up when I use a schedule.
Let’s say I have two instance parameters for now; Code which is a string and Color which is a material. Now I have an excel file with all the colors and their corresponding codes.
What I want to do is link each Color parameter value to its corresponding Code parameter value so that when I change one instance parameter value the other would change accordingly and I wouldn’t have to type the code manually for each different instance (color).
I attached an image to show what I have done so far.
I think the set parameter value by name nodes are the key to solve this, I need a way to somehow link those two nodes so the value in one is dependent on the other, but I could be wrong.
Would really appreciate any help.
Thank you.

Look into dictionaries.

Hey, I did take a look and then I tried a different configuration but I still can’t seem to get the value of one parameter to change based on the value of the other. I attached an image to clarify.
Any further help is greatly appreciated.

Can you repost this with node previews turned on? It’s nearly impossible to tell what’s going on without seeing what your individual inputs and outputs look like.

I actually got it to work finally. I have another question though, would it be possible to associate more than one value with a key?

Sort of. You can either create multiple dictionaries or use one dictionary with a list of values associated with each key. If you go with the list then you’ll just have to get each item individually when writing to the parameter. No a big deal though as you’ll control the order of the values anyway.

I’ve been away from the subject for quite a while but thank you for the reply, I managed to get it to work. Is it possible for me to reverse the process though? As in get the key corresponding to two values? Or just have a value change depending on two other values?

Yes. You can get keys from a dictionary.

Don’t quite follow.

Yeah I can get the keys using dictionary.keys but not the key corresponding to a certain value(s). I can’t find a function like get value at key that lets me get the key for the value.

It depends on what package you’re using. Lunchbox has GetDictionaryKeysValues which will return both. Other packages might require you to get keys and values separately. From there you can use a given value to filter the list of keys. Python also has ways to do this.

Alright thank you, will be trying your suggestions.