4 Replies Latest reply: Aug 19, 2014 3:23 AM by Sean Reardon RSS

    Break up a nested For


      I have a rule in a file with a nested For, about four or five levels deep, sort of like:


      For( relation01, For( relation02, For( relation03, some attribute) ) )


      Is there a way to split this into multiple lines? I tried shift-enter and alt-enter, and neither worked.

        • 1. Re: Break up a nested For
          Jasmine Lee-Oracle

          A soft-enter (shift+enter) certainly works for splitting a regular calculation rule onto multiple lines. Have you made paragraph markings visible in MSWord so you can confirm the shift+enter did indeed register as a soft enter?


          See section 7.2.5. Soft Enters in Calculation Rules for what it looks like with regular calculation rules: http://www.oracle.com/technetwork/apps-tech/policy-automation/learnmore/policymodelingbestpracticeguide-1371173.pdf



          • 2. Re: Break up a nested For

            I thought I tried shift-enter before. Maybe I did not. Now it works.


            Thanks for the info.

            • 3. Re: Re: Break up a nested For

              You can also you the ForScope or the English equivalent of any For operation "In the case of"





                        some attribute


              In the non-function form:


                 In the case of relation01

                     In the case of relation02

                         in the case of relation03

                             some attribute

              In this each function is at a new rule level. The advantage of this approach is you can have multiple rules and each level as you normally would. In the normal functional For operation you must resolve everything in a single attribute.

              • 4. Re: Re: Break up a nested For
                Sean Reardon

                You should always try to avoid over-nesting things by trying to create intermediate attributes. The simplest reason for doing this is that it makes debugging that much easier - you can see what the value is rather than trying to work out what it is being combined together as.


                Sometimes that is not possible when performing certain complex cross entity reasoning - but given that you were using the For operator that is unlikely to be the case here.


                Also given you were using the For operator I'll raise the question of whether or not any of the relationships you are traversing are containment relationships? Because if they are all containment relationships then you don't need to use the for operator at all. If any are containment relationships then you can exclude those layers which are traversing the (reverse) containment relationship.