This content has been marked as final. Show 6 replies
Excellent solution. A few comments, not on the approach itself but on some Structure/Rule best practices:
1) Your shadow Options could just as effectively be modeled as Boolean Features instead, which would reduce by half the number of nodes required to achieve the behavior.
2) For Statement Rule readability and maintenance, it is better to minimize your paths to just that which is required for uniqueness. So if there is only one node in your Model named 'I agree-SD', then that's all you need to use in a Statement Rule to refer to that node. In your example, there are multiple nodes named 'Yes', so just using 'Yes' in the Statement Rule would be ambiguous; but instead of using 'Online Radio Licence'.'Service Details'.'Based in UK'.'Yes', you could just use 'Based in UK'.'Yes'.
3) When you need to check whether any of the Options within a required Option Feature has been selected, instead of using AnyTrue and listing out each Option, it is preferred to use the Options() System Property on the Option Feature: AnyTrue('Estimate Listener Hours'.Options()). In addition to being simpler to write, it also eliminates the need to modify the rule if Options are added to or removed from the Option Feature in the future.
4) With the exception of the construct in #3 above, when there is only one argument in your AllTrue or AnyTrue, then the AllTrue or AnyTrue is redundant, and may be omitted.
5) You should only use the DEFAULTS relationship when defaulting behavior is what you need. When you are setting a logical value that you want to allow the user or another rule to override, then DEFAULTS is appropriate. Otherwise, you should use IMPLIES. Default rules have performance impacts on your Model that you should avoid unless it is necessary.
Using all of these recommendations, your example Statement Rule would be simplified to:
AllTrue(AnyTrue('Licence Type'.Options()), 'I agree-SD') IMPLIES 'Licence Options Valid';
AllTrue('Licence Options Valid', 'Service Name Valid', 'Provider Valid', AnyTrue('Based in UK'.Options())) IMPLIES 'Service Details Valid';
AllTrue('Service Details Valid', AnyTrue('Estimate Listener Hours'.Options()), AnyTrue('Report Listener Hours'.Options()), AnyTrue('Report Countries'.Options()), AnyTrue('Report No of times'.Options()), AnyTrue('Report Sound recordings'.Options())) IMPLIES 'Reporting Details Valid';
Hope this helps!