I’ve got a pretty involved graph that I want to take one action if it runs in 2016 and different action if it’s in 2017.
My problem is that there are several parts the run in both, and there’s no clear division I can see to pipe into an IF node.
I’ve been dealing with it by Freezing one node and Unfreezing the other depending on which version of Revit I’m in.
Those are the purple and blue Groups in the center.
I know how to find the Revit version, I just don’t know how I can split up my graph based on the results.
The first part of this Graph runs under 2016 and compares its Text elements the 2016 upgraded version.
It examines the height of the Text Boxes and automatically widens the Text Box a little bit (~6%) if the text wrapped onto an additional line.
I’d like to share this with the community, but I’d like it to run without tweaking for both versions.
Any suggestions on how I can branch in the middle? As you can see, there are wires that both branches need on both sides of the branch.
I think this is what you’re wanting.
Yes, I understand how to get the Version number.
What I’m asking about is the “Do this stuff in 201#” Code Blocks.
I need to do:
- Everything in the left group for both cases
- The purple stuff for 2017
- The dark blue for 2016
- The top green for both
- The bottom green for 2017
- The light blue for both
- The orange for 2017
A simple, one node operation for an IF is pretty straightforward, but it gets messy if you’re doing a lot of processes
You need to break the data at the beginning of each chunk. Considering I’m not familiar with the graph (the extent of the in/out), it makes it very difficult to offer solutions.
An example of breaking the data at the beginning is below. As you can see the green portions (Revit 2016 pretend data) are not running.
I didn’t expect you to solve the whole thing for me.
But your image did help clear up one big thing for me.
From the examples I’ve seen I had thought all the hard work had to be done on the left side of the IF (or ==)
But I like your trick of passing a boolean toggle & using the in /out to shunt the effort around.
Glad to help out! Post updates or if you need anything else
Here’s a grossly simplified version of what I’m trying to do.
Simplified even more: I want to Write an Excel file if I’m in 2016 and Read it if I’m in 2017.
In this sample, I tried to feed a number into the file name, but that’s not very clean. I don’t like forcing an error condition.
Is there any way to prevent the node from being fired at all?
Tried it as above, passing a Number 0 as the file name to the Excel.ReadFromFile node
It still fires the node & opens Excel with a blank document
The List.Empty trick seems to work, but now my IF statement is failing!
It looks like everything is being fed in properly, and it correctly find the Version, but the IF returns EmptyList even though that’s the false case.
The == is true, so why is the path not being passed through the IF?
@DaveP - Use ScopeIf instead. IF cannot deal with inputs of different lengths (in your case a singleton vs. an empty list). Please note that ScopeIf may however not work stably on larger / complex graphs (although by the looks of it, it should work in your case). In those (fairly rare) cases, see my comment on the issue linked below for a workaround:
Also, an alternative may be to pass a null value instead of an empty list.
ScopeIf looks like it does the trick.
I didn’t know the mixed lists was a problem, much less that there’s a Core node that does work.