Code block not working for all lists

hello, How do you get a code block to work for all items in an input list. Usually I dont have to do anything but now its not working. I tried the example from another post on this site to set the lacing in the code block to longest, but its not working. I am trying to return a list of 0,1 if the first option is met, then a list of 2,3 if the second. However it seems to only be reading the first item in the input list, making and output and then quitting. I tried the same thing with the code block not set to longest, but it yields the same result. Please advise!

Try not doing them in line and using an intermediate test. If your use case is more elaborate, try leveraging a dictionary to make your life easier.

1 Like

Hello, can you please elaborate on what you mean by an intermediate test?

In the first example I used the Boolean test to pull a 0 or a 1. Once done I was able to use that value to drive a List.GetItemAtIndex node and provide the desired result.

In the second example I returned values of “a” or “b”, which allowed me to pull the desired value from the dictionary. This may be more valuable for you as often your work isn’t a “this or that” situation, but a “one of many possible options” situation, and using numbers to keep track of the various values can get tricky.

Ok sorry, it doesnt appear that my code blocks are recognizing dictionaries. What version of dynamo are you using? Also your syntax seems different that I would expect with the [ and ('s. Is there a place where I can go to read more about what the dictionary method is and how to use it/understand it better? Thanks!

Dynamo 2.0.2 or 2.1.0.

Another dot in between 98 and 99 would also help

Ok, I cant seem to get this to work. But I feel like it should. I tried both take items and a get item at index node that should return the same result. But I cant get either one of them to work. What am I doing wrong?

This might help.

Used a data set around the benefits of migrating to 2.0 from 1.3, as two of the proposed solutions have been made more difficult as a result of the older tech.

Oh I am well aware. Everyone says its better all the time. the problem is its not backward compatible and darn near impossible to install and use. Ive tried the past 2 days to install that stupid thing and every single time I try i end up wasting my ENTIRE DAY. It is a huge problem. Every single time I try to use it it crashes Revit, wont download and install packages, gives vague yet painful warnings all over the place, it is such a pain i cant even explain how frustrating it is. Does it even work for Revit 2019? it doesnt seem like it, thats for sure!
This is all dynamo 2.0 does:

I’ve been using it and pretty much only it for the last 6 months. Maybe complete uninstalls are in orde? Also check package versions before you add them.

The good news for you is that 2020 is 2.1 or bust, so there won’t be any install issues for you at that point.

Yeah I spent all day yesterday doing full uninstalls to no avail. I had 1.33 and 2.02 installed simultaneously, so I first uninstalled 1.33 and when that didnt work I uninstalled 2.02. then reinstalled 2.02 only restarting each time. Then when that didn’t work, I uninstalled Revit. and reinstalled. but still there is no difference. I am able to open 2.02 now in Revit 2019 but it still crashes if I try to open a graph from 1.33.Also, any typing (like into a code block or something) for more that 2 characters makes Revit “ding” like it is trying to register everything I type into dynamo as a command. Which is super annoying and I had to turn my sound off for this reason. Also, the delete key doesn’t work in dynamo, and just penetrates dynamo and actually deletes whatever you have selected in Revit which is also super annoying. I also tried installing Dynamo 2.1 but it doens’t seem to work at all. Is there only a sandbox version (not that it works) or is there one for Revit as well. I tried clicking on the .exe but it did nothing and I don’t see a setup or install button anywhere in the folder. Please see below:

You need to update Revit 2019. Current build is 2019.2.1.

The 2.1 installer is Sandbox only as discussed in the blog post on the topic and as indicated as ‘DynamoCoreRuntime’ file names instead of DynamoRevit file names. Try the daily build for 2.0.3 to see if your crash is triggered by the repaired library glitch.

Hi again,
I cant install Revit 2019.2.1 for difficulties reasons laid out here: I am aware it exists, but am not able to get it. I will try 2.0.3 and see if that does anything. Thanks

Not sure who you are in that thread, but I will send you a PM as I’d need some confidential stuff to square that away.