Jacopo,

Sure, I'll test this new patch and let you know the results once it's done. 

--
发自我的ONEPLUS智能手机

Jacopo Cappellato <[email protected]>编写:

>It would be great if you could test this improved version of the patch that I 
>sent you: it internally uses the EXTRACT function that should be a standard 
>function since SQL-99.
>
>Thanks,
>
>Jacopo
>
>
>Index: framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
>===================================================================
>--- framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java   
>(revision 1641394)
>+++ framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java   
>(working copy)
>@@ -65,6 +65,8 @@
>         functionPrefixMap.put("count-distinct", "COUNT(DISTINCT ");
>         functionPrefixMap.put("upper", "UPPER(");
>         functionPrefixMap.put("lower", "LOWER(");
>+        functionPrefixMap.put("year", "EXTRACT(YEAR FROM ");
>+        functionPrefixMap.put("month", "EXTRACT(MONTH FROM ");
>     }
> 
>     /** Contains member-entity alias name definitions: key is alias, value is 
> ModelMemberEntity */
>@@ -480,7 +482,7 @@
>                     fieldSet = alias.getFieldSet();
>                 }
>             }
>-            if ("count".equals(alias.function) || 
>"count-distinct".equals(alias.function)) {
>+            if ("count".equals(alias.function) || 
>"count-distinct".equals(alias.function) || "year".equals(alias.function) || 
>"month".equals(alias.function)) {
>                 // if we have a "count" function we have to change the type
>                 type = "numeric";
>             }
>
>
>On Nov 18, 2014, at 11:40 AM, Jacopo Cappellato 
><[email protected]> wrote:
>
>> Thanks for letting me know it worked for you.
>> I will commit it sometime soon if no one will object.
>> 
>> Best regards,
>> 
>> Jacopo
>> 
>> On Nov 18, 2014, at 4:37 AM, [email protected] wrote:
>> 
>>> Dear Jacopo,
>>> 
>>> Thanks so much for your kind help, the solution works perfectly as it is 
>>> exactly what I wanted ! Now I can summary the total in the dimensions I 
>>> want, i.e. MONTH and YEAR. Thanks so much again, and I also think it is 
>>> helpful to commit these two added functions to public trunk in case others 
>>> have similar requirements like mine.
>>> 
>>> --
>>> 发自我的ONEPLUS智能手机
>>> 
>>> 
>>> 
>>> Jacopo Cappellato <[email protected]>编写:
>>> 
>> 
>

Reply via email to