Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Displaying calculated fields

    Using smartgwtpower2.5 nightly, gwt 2.3.0. I'd like to know what the best way to display calculated fields in a listgrid is without retrieving all the rows unnecessarily? Here is a sample query:
    Code:
    select name, color, price, avg(value), min(value), max(value) stddev(value) from table group by name
    I've read through the Data Integration and the Smart GWT Server Framework chapters in the quickstart guide and I see it is possible to intercept the DSRequest and DSResponse, but I don't need to return individual rows, just the calculated values. If possible, I'd like to use a ds.xml file however I don't know of a way to specify a field that is not present in the actual table. Also, how would I modify the select statement in the query to include the calculations? Any help is much appreciated.

    #2
    Take a look at the SQL-> Dynamic Reporting sample, it does just about exactly this. For background, see also the QuickStart Guide sections on SQL Templating in the Server Framework chapter.

    Comment


      #3
      Originally posted by Isomorphic
      Take a look at the SQL-> Dynamic Reporting sample, it does just about exactly this. For background, see also the QuickStart Guide sections on SQL Templating in the Server Framework chapter.
      I followed the dynamic reporting example and when I filter by date only, it works properly. However, I have value maps in the filter editor, so when the filterEditor filter button is pressed the criteria is converted to advanced criteria and the $criteria.startDate is never converted to the actual date so the I get the ORA-00911 error, invalid character. How can I fix this? I need to keep the value map functionality.

      Comment


        #4
        See the docs for dsRequest.getCriteriaValue() - it can extract a criteria value from AdvancedCriteria regardless of nesting. In Velocity, $advancedCriteria.fieldName is equivalent to this.

        Comment


          #5
          Originally posted by Isomorphic
          See the docs for dsRequest.getCriteriaValue() - it can extract a criteria value from AdvancedCriteria regardless of nesting. In Velocity, $advancedCriteria.fieldName is equivalent to this.
          I was able to use $advancedCriteria.fieldName. I changed the the filtering to use this instead. However, I was unable to get the groupWhereClause to do anything with the $defaultWhereClause. I had to move the $defaultWhereClause to inside the whereClause and it works fine. There is however a nasty bug in the filtering that I noticed while testing my listgrid. If you play with the example, the filtering doesn't work correctly when you press the small filter button on the filterEditor several times when entering different values in the editor. Trying to filter multiple times doesn't work correctly. The initial click on my small filter button on the listgrid works, then when i select another value in another column from a value map and click the small filter button, it says no items to show and a trip to the server is never made.

          Comment


            #6
            We played with this and couldn't get a reproduction of what you're seeing. Can you give specific steps?

            Comment

            Working...
            X