Ticket Q433926
Visible to All Users

Documentation - Improve documentation on the Single aggregate (add examples, describe limitations, etc.)

created 13 years ago

Hi,
I experienced that it's not allowed to use criterias with a nested single aggregate. Could you explain why this isn't possible in Xpo, because in "normal" SQL it's possible and sometimes very helpful! Furthermore I think that it would be great to have some more documentation for the single aggregate. For now its only mentioned in the "What's New" article.
Best regards,
Kim.

Answers

created 13 years ago (modified 13 years ago)

Hi, Kim. The mistake with our first example was the missing ".Oid" parts. I have updated the criteria expressions in our previous answer. Your modified example is attached as well. If you experience any difficulties with the Single aggregate, fell free to update this discussion. We are relentlessly working to improve our help documents and any comments that you may have, would be greatly appreciated.

    Show previous comments (3)

      Thanks for your explanations Konstantin!
      Please add your last note in the upcoming documentation about it. It's good to know.
      To sum up, I can say that its neither possible to use a nested single nor it can be transformed into an expression without removing single aggregates. Sometimes it may be possible to write the subquery without using single aggregate, i.e. using the "old" way before single aggregate was implemented: [<Class2>][^.Oid = Ref2.Oid].Max(Data2) = Data - or transform it into an expression without any subquery aggregate like Konstantin posted, but sometimes it can't. So do you have plans to extend the single aggregate feature to allow using it in a nested query?

      Dennis Garavsky (DevExpress) 12 years ago

        Thank you for your feedback, Kim. We will take it into account when updating our docs.
        As for your last question, I am afraid we do not have immediate plans for this. We will post an update here once we have any news in this regard.

          Thanks, that would be great!

          created 13 years ago (modified 13 years ago)

          Hello Kim,

          Thank you for contacting us. As we understand you, you are having problems with expressions like in the following example:

          [<Class1>][^.Oid = Ref.Oid And [<Class2>][^.Oid = Ref2.Oid].Single(Data2) = Data].Single(Data)

          In this case, the generated SQL will be valid neither by logic nor by syntax.

          However, it is always possible to transform such expressions without losing their original sense as follows:

          [<Class1>][^.Oid = Ref.Oid].Single([<Class2>][^.Oid = Ref2.Oid & ^.Data = Data2].Single(Data2))

          As for documentation, I agree with you, it can always be improved. We will consider putting more examples regarding this new aggregate type and describing its specifics, like the one above. Thank you for your input in this regard.

            Comments (3)

              Hi Dennis,
              thanks for explanations! It's good to know that it should be possible to use the single aggregate this way. But I experienced some problems, reproducing your example to better understand it and it's limitations. Maybe I've implemented your little example wrong, but I did my best ;). I have put your criterias within persistentalias criterias to test them. So I can easily switch between servermode on/off to test them on serverside and clientside.

              1. I wasn't able to transform your first criteria into a working criteria without to use a nested single aggregate.
                In fact I don't really understand how it's possible to remove the second condition of your example "[<Class2>][^.Oid = Ref2].Single(Data2) = Data" and put it within the aggregate function without losing the original sense. In your transformed example the only condition to look for Class1 objects is "^.Oid = Ref". But what if the second conditions is required to make this result unique? So the single aggregate would not work if the result isn't unique.
              2. If I understand your transformed expression right, it's possible to write some other complex criterias within a single aggregate … so it should work to write something like this:
                [<Class1>][^.Oid = Reference].Single([<Class2>][^.Oid = Reference2].Single())
                to return a Class2 object, right? But this doesn't work for me.
                Greetings,
                Kim.
              Dennis Garavsky (DevExpress) 13 years ago

                Thank you for the update, Kim.
                We will research your issue and get back to you as soon as we can. Please bear with us.

                Dennis Garavsky (DevExpress) 13 years ago

                  Kim, it was my bad as my first example was inaccurate. I asked our tech writer Konstantin provide an updated example for you. Please bear with us!

                  Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

                  Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.