Revit. Parameterization. Parts Strategy. CVIF, DISTINCT, NOT Functions. Extending JOIN Function
Today we have released an update to the Parameterization plugin, which at first glance does not have many changes. But these changes are so important and useful that we decided to write a news story!
Strategy Parts
The new strategy allows you to process parts. At the same time, there is a connection with the source elements from which the part is formed. That's right - in the plural. The API tells us that one part can have several source elements. To be honest, we don't know how this is done, but we added a restriction - if there are several source elements, the plugin will take the first one that comes across. In 99% of cases, this is what users will need.
NOT function
One day a user asked "How can I set a condition that TMIRRORED() is False?". "And really - how?" thought we and made a NOT function that inverts the result of conditional functions or expressions. For example, NOT(1=2) will return TRUE.
Extending JOIN function and DISTINCT function
We recently released a major update in which we added the ability to write values to a conditionally source element. For this purpose we added two special functions: SUM - summarizes numeric values, JOIN - adds values into one line, separating them by a specified delimiter. And when using the JOIN function, users have a question "How to get only unique results?". I.e. "How to remove duplicates?". We have made two solutions to this question:
1. Added the DISTINCT function. This function will take a string, split it into parts with the specified delimiter, remove duplicates, and then write the results back as a string with the same delimiter. The function takes whitespace into account to more accurately identify identical values. For example, if you had the string "a, a, b" and you specified the delimiter "," the value of "a" and " a" are not the same, but the function will consider them to be identical!
2. Added the ability to specify a 3rd argument "d" in the JOIN function. If the argument "d" (from the word Distinct) is specified, the function will also remove all duplicates from the list of values before writing the result to the parameter. However, the function entry looks a bit odd, which will take some getting used to. Especially if you use a comma as a separator - JOIN(@[p],,,d), or a comma with a space - JOIN(@[p],, ,d).
But that's not the only new feature of the JOIN function! You can now specify the value "s" (from the word Sort) as the 3rd argument and the function will sort the values in alphabetical order before writing the result to the parameter.
And of course you can specify the "ds" argument to make the function perform both duplicate removal and sorting!
CVIF function
Finally, the main new feature we really wanted to tell you about is the CVIF function! Like the CV function, the CVIF function allows you to get a value from an Excel file, but by conditions! The function goes through the rows and checks the specified conditions - if all of them match, the function returns the cell value from the specified column. The conditions, respectively, are specified for the values of the row cells.
The best way to explain how this works is with a simple example. Here we have written a formula:
And this is the Excel file attached to the strategy:
The function will go through the rows and check the value in column "B" with the condition "equal to 1" and if the condition is true, it will return the value from column "D". In our example, "test3" will be written to the "Comments" parameter.
We are sure that this function has a huge potential for use! Be sure to try it and tell us about your emotions!
Enjoy your work with ModPlus!