OGDesigner Posted Friday at 02:18 PM Share Posted Friday at 02:18 PM Is it possible to create a Custom Object Field that compares two known values (like Length vs Height) and return the higher of the two values? We run piping in our design that is both horizontal and vertical. If the piping is vertical, the Height is the length of the pipe but if the piping is horizontal, the Width is the length of the pipe. I would like to create a new Custom Field that compares the two and returns the larger so I can total the column in my schedule for Total Length of Pipe. Thanks for any suggestions! Link to comment Share on other sites More sharing options...
Alaskan_Son Posted Friday at 04:10 PM Share Posted Friday at 04:10 PM Use a simple Ternary Operator: %height > width ? height : width% ...or put into an Array and use the max method: %[height, width].max% Link to comment Share on other sites More sharing options...
OGDesigner Posted Friday at 06:43 PM Author Share Posted Friday at 06:43 PM Alaskan_Son, This is brilliant and worked like a charm! Is there a reference to writing these operators? Thanks so much Link to comment Share on other sites More sharing options...
Alaskan_Son Posted Friday at 07:07 PM Share Posted Friday at 07:07 PM 12 minutes ago, OGDesigner said: Alaskan_Son, This is brilliant and worked like a charm! Is there a reference to writing these operators? Me! Joking Okay, Not joking ... Its tricky because you have to use both Ruby (programming language) and Chief which are 2 entirely different and separate constructs. You can use any number of online resources to learn how to program in Ruby including the actual Ruby documentation, the StackOverflow forum, and even ChatGPT... ...But then you also have to learn how to use the various tools that Chief has given us to work with. This is where it gets tricky. There is a lot of nuance and interplay between the 2. We have certain information in Chief that we can access and parse, various ways to access and parse that information, and some (but not all) of those ways can optionally use Ruby. Chief has quite a bit in its documentation about built in name:value pairs, special built in Classes and Methods, and other text macro stuff, but has very little about actual Ruby programming (and rightfully so). If you're serious about custom macros and otherwise using Ruby to access and parse information in Chief, it is well worth the effort to pay for an hour or 3 of consultation/training time. You'll save yourself many hours...days..even weeks of otherwise unnecessary experimentation. 1 Link to comment Share on other sites More sharing options...
OGDesigner Posted Friday at 08:08 PM Author Share Posted Friday at 08:08 PM Understood. Thanks for the information. This certainly opens up a new level to Chief that is worth checking out. I'll start with what I can find in Chief and see where I can go from there. Thank you for the help! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now