Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-11041

Incorrect findByCount on DynamicView with groupBy and selected field

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Trunk
    • 16.11.06, 17.12.01, 18.12.01
    • framework
    • None

    Description

      When you create a DynamicView with group by function and you realize a delegator.findCountByCondition() with selected fields, the result was different than count each element returned by delegator.findList().

      In cause :

      Index: framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java
      @@ -1031,7 +1031,7 @@
       
               // GROUP BY clause for view-entity
               if (isGroupBy) {
      -            modelViewEntity.colNameString(modelViewEntity.getGroupBysCopy(), sqlBuffer, " GROUP BY ", ", ", "", false);
      +            modelViewEntity.colNameString(modelViewEntity.getGroupBysCopy(selectFields), sqlBuffer, " GROUP BY ", ", ", "", false);
               }
      

      modelViewEntity.colNameString returns all grouped by fields for realize goup by closure and not only thegrouped by fields present on  selected fields.

       

      Attachments

        Activity

          People

            nmalin Nicolas Malin
            nmalin Nicolas Malin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: