5 Replies Latest reply: May 16, 2013 12:58 PM by Eogan RSS

    Need to write a CDL rule with out using the TOTAL and CONTRIBUTE in it.

    GSPYadav
      Hi,

      I need to write the CDL rule without using the Total and Contribute for the following scenario, can anyone give a suggestion how can we write CDL rule.

      I have CompoentSet which have Integer Feature with the name A(Integer Feature).

      ComponentSet
      cSet:
      |-------->Component[1]-----> A (Integer Feature)
      |-------->Component[2] -----> A (Integer Feature)
      |-------->Component[3] -----> A (Integer Feature)
      . .
      . .
      . .
      |-------->Component[n] -----> A (Integer Feature)

      The rule has to return the sum of all the A's (Integer Feature’s) in all components . The number of components and the value of the node A may vary at runtime.

      Thanks,
      Shivaprasad.G
        • 1. Re: Need to write a CDL rule with out using the TOTAL and CONTRIBUTE in it.
          Eogan
          Shivaprasad --

          Why in the world would you have a restriction on using certain syntax in a Statement Rule?

          In any case, you don't need CDL at all to do this. Just create a Numeric Rule in the parent Model with A on the left side of the rule. The sum of all the A values in all of the Components will get contributed to whatever numeric node you put on the right side of the rule.

          Hope this helps. If it doesn't, please provide some more detail on your scenario.

          Eogan
          • 2. Re: Need to write a CDL rule with out using the TOTAL and CONTRIBUTE in it.
            GSPYadav
            Hi Eogan,

            yes it will work for sure, but it giving problem while roll-backing and overriding the transactions in extension.

            I tried with all possible cases finally I found that CONTRIBUTE rule is causing the issue. So please suggest me alternative solution for this problem.

            Thanks.
            • 3. Re: Need to write a CDL rule with out using the TOTAL and CONTRIBUTE in it.
              Eogan
              Shivaprasad --

              You would really need to provide more detail on your scenario and the exact problem(s) you're experiencing in order for me to suggest an alternate approach.

              Eogan
              • 4. Re: Need to write a CDL rule with out using the TOTAL and CONTRIBUTE in it.
                GSPYadav
                Eogan

                The model structure is same as i mention above.

                Initial value of the Integer Feature is 1. Through portal I am trying to change the value of the integer feature A to 2. I have a rule on the total (sum)which doesn't allow the sum greater than 6.

                In code after changing the value of the integer feature I'm checking whether it giving any LogicalOverridable Exception or not, if so simply roll backing the transaction to previous state in mean while I'm prompting the the user in portal whether you want to continue YES or NO.

                if user selects YES then again set the value to the same integer feature and then in LogicalOverridable Exception block I'm overriding the transaction instead of roll backing. But for the second time I'm not getting the LogicalOverridable Exception at all it simply setting the value.

                Shivaprasad
                • 5. Re: Need to write a CDL rule with out using the TOTAL and CONTRIBUTE in it.
                  Eogan
                  Shivaprasad --

                  Thanks for the additional information. It would also be helpful, though, if you would provide a non-technical description of the scenario you're trying to accommodate.

                  I also don't know what you mean by "portal". Does your Configurator application have an end user, or is this all being done as part of an automated process? If there is an end user, are they using a UI generated in Configurator Developer? What are the multiply-instantiated Components? What is A, and why is it being changed programmatically to 2? Why can't the sum of the As be greater than 6?

                  I'd like to understand the scenario more completely so that we can ensure you're employing the optimal solution. Getting into the details of CONTRIBUTES rules and Overridable Exceptions is only going to be worthwhile once we ascertain that you shouldn't be taking an entirely different approach to achieve your desired results.

                  Eogan