4 Replies Latest reply on Apr 19, 2012 1:08 PM by Lazar NameToUpdate

    Is it possible to compare values within an extended object?

    Chad Johnson

      I have created an EO that outputs data in the following manner:

       

      memplace_mapped_file:0:0:0:0:2::D:

      memplace_shm_anonymous:0:0:0:0:2::D:

      memplace_shm_named:0:0:0:0:2::D:

      memplace_stack:0:0:0:0:2::D:

      memplace_text:0:0:0:0:2::D:

       

      This results in the first field being the "Name" and each subsequent field being "Value 1", "Value 2", "Value 3", etc.  I need to write a compliance rule to compare "Value 1" to "Value 2" but It appears that in a foreach loop you can only select the loop iterator "Value 1" in the left hand side of the rule, I need to check if Value 1 equals Value 2 and the values can vary on the systems. 

       

      Is there any way I can do this?

        • 1. Is it possible to compare values within an extended object?

          You can write next rule:

          foreach "Extended Object Entry:abc//total"

             "Value1 as Integer (All OS)" = "Extended Object Entry:abc//total"."Value2 as Integer (All OS)"

          end

          In which you can select in the left hand side the object "from scratch" (regardless of the loop iterator).

           

          Maybe I didn't understand your question, but what's wrong with next rule for your purpose:

          "Extended Object Entry:abc//total"."Value1 as Integer (All OS)" = "Extended Object Entry:abc//total"."Value2 as Integer (All OS)"?

          • 2. Re: Is it possible to compare values within an extended object?
            Chad Johnson

            The problem is that I do not know what Name/Value pairs may be created in the Extended Object, they can vary from system to system.  I cannot hard code anything in the rule because of this.

             

            What I need is the equivalent of this:

             

              foreach "Extended Object Entry:AIX VMO Default Settings//*"

                 "Value1 as String (All OS)" = "Value2 as String (All OS)" 

              end

            • 3. Re: Is it possible to compare values within an extended object?
              Bill Robinson

              You could modify the grammar for csv to use a colon as the delimiter – that may make this easier.

              • 4. Is it possible to compare values within an extended object?

                I did some testing, and here's what I think...

                 

                foreach "Extended Object Entry:AIX VMO Default Settings//*"

                     "Value1 as String (All OS)" = "Value2 as String (All OS)" 

                  end

                 

                The problem is that the LHS is taken as an extention to the foreach statement, so it resolves to:

                Extended Object Entry:AIX VMO Default Settings//*"."Value1 as String (All OS)", where * is the element at the time.

                The RHS, is used as is and not as extention, so in present form we compare whatever LHS resolves to to literaly "Value2 as String (All OS)", and fail.

                 

                For the RHS to resolve, we need to specify the full EO entry syntax, but if we leave the star, it will just iterate through all of them (similar to two imbeded for loops).

                 

                I see the value in this being "as designed" and being a "defect", so I'll work with dev.

                 

                Lazar