I have a property called "X" which is vizible and enabled, it has also a default value under formula,
result = 1, but could be changed to any value in run time.
And i have another property "Y" in the same part family. I want X to be reset to the default value in this example 1 when y is changed by the user. I appreciate any help.
Solved! Go to Solution.
Although it is possible to do this with the when-changed formula of the second property, that approach is not recommended and has the disadvantage of no tracability. There will be no way for the user (or rule author who is maintaining this part family in the future) to know why the value of X all of a sudden changed. Right-clicking and asking how I got my value would only tell you the formula ran and there would be nothing in that formula to explain why it changed. Asking for dependencies would not show that dependency. This invisibility of what is going on makes for a difficult time maintaining rules.
A better approach is to use the built-in functionality of "auto-revert" behavior of a property and "fake" a dependency on the other property. Auto-revert behavior automatically throws out a user's input when a dependent property changes. You could fake the dependency by making the value formula like:
Dim FakeDependency As Double = me.Y
Result = 1.0
Thus, when Y changes, the value of this property will be set (back to) 1 by the kernel automatically. When a user would ask "how did I get my value", they would clearly see it is an auto-revert property, and, asking "what do I depend on "would show the me.Y as an upstream dependency (and the opposite would be true asking "what depends on me for Y would show me.X as a dependent property), making it obvious what is going on and hence easy to maintain.
In general, there are a *very* limited number of recommended uses for when-changed formulas. When-changed formulas should be used only as a very last resort.
Thanks for your help Rick_S,
The solution works great!!!
I have a similar question, but this time. I have a property which depends on changes of several properties. To illustrate it with an example:
I have properties:
x = 0
y = 0
z = 0
w = 0
I want x to change based on which property is changed by the user.
if y is changed by the user,
then I want x to be 1
if z is changed by the user,
then x = 2
if w is changed to any value by the user,
then x = 3
I know this could be solved using the "when-changed" tool in rulestream, Can i use the revert method in this case (by declaring multiple variables for the fake dependencies) ?
Thank you so much for your time.