Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0035536Openbravo ERPB. User interfacepublic2017-03-15 21:312017-04-01 12:06
rbianchini 
inigosanchez 
normalmajoralways
closedfixed 
5
3.0PR16Q3.3 
3.0PR17Q2 
alostale
Core
No
0035536: Problem to use summary function in a computed column that has a selector as reference
When you want to use a summary function in a computed column with selector reference trhows the next error.

Error
Exception When creating query select max (e.tESTISUTABLETHREEID._computedColumns.tESTISUTABLETHREEID.text) from TESTISU_TABLEONE and left join as e._computedColumns.tESTISUTABLETHREEID as join_0 Where e.organization.id in ('E443A31992CB4635AFCAEABE7183CE85', '0', 'DC206C91AA6A4897B44DA897936E0EC3' '7BABA5FF80494CAFA54DEBD22EC46F01', 'BAE22373FEBE4CCCA24517E23F0C8A48', '19404EAD144C49A0AF37D54377CF452D', 'B843C30461EA4501935CB1D125C9C25A', '2E60544D37534C0B89E765FE29BC0B43') and e.client.id in ('23C59575B9CF467C9620760EB255B389', '0')

The log is attached
Steps to reproduce error
1-Install module com.precognis.testisues.obx (in issueFiles.zip) This module contains three tables:
*TESTISUTABLETHREE: contains in addition to the mandatory columns, a column of
type text.
*TESTISUTABLETWO: contains in addition to the mandatory columns, a column of type text and a reference to TESTISUTABLETHREE.
*TESTISUTABLEONE: contains in addition to the mandatory columns, a column of type text, a reference to TESTISUTABLETWO and also a computed column of reference type selector, which takes the field TESTISUTABLETHREE from the record of the table TESTISUTABLETWO referenced in this record.
2-Create a regiter in the table TESTISUTABLETHREE.
3-Create a regiter in the table TESTISUTABLETWO that points to the record created previously.
4-Create a regiter in the table TESTISUTABLEONE that points to the registry created previously.
5-Go to table TESTISUTABLEONE and set a summary function max in column TESTISUTABLETHREE_ID
6-You get the error
No tags attached.
related to defect 0034324 closed inigosanchez Summary function does not function for WIndow's created using hql tables. 
related to design defect 0029765 acknowledged Triage Platform Base Cannot add summary functions to formula fields 
zip issueFiles.zip (20,949) 2017-03-15 21:31
https://issues.openbravo.com/file_download.php?file_id=10574&type=bug
Issue History
2017-03-15 21:31rbianchiniNew Issue
2017-03-15 21:31rbianchiniAssigned To => platform
2017-03-15 21:31rbianchiniFile Added: issueFiles.zip
2017-03-15 21:31rbianchiniModules => Core
2017-03-15 21:31rbianchiniResolution time => 1491361200
2017-03-15 21:31rbianchiniTriggers an Emergency Pack => No
2017-03-16 09:41alostaleRelationship addedrelated to 0034324
2017-03-16 09:41alostaleRelationship addedrelated to 0029765
2017-03-17 09:28alostaleNote Added: 0095354
2017-03-17 09:29alostaleStatusnew => acknowledged
2017-03-27 12:38inigosanchezAssigned Toplatform => inigosanchez
2017-03-28 15:49inigosanchezStatusacknowledged => scheduled
2017-03-28 15:49inigosanchezNote Added: 0095607
2017-03-28 17:57inigosanchezNote Added: 0095614
2017-03-29 09:42inigosanchezReview Assigned To => alostale
2017-03-29 09:42inigosanchezResolution time1491361200 => 1491343200
2017-03-29 09:46hgbotCheckin
2017-03-29 09:46hgbotNote Added: 0095628
2017-03-29 09:46hgbotStatusscheduled => resolved
2017-03-29 09:46hgbotResolutionopen => fixed
2017-03-29 09:46hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/e10bc2fc5f83a9ebb3dcbdc6ce936e79756973ce [^]
2017-03-30 00:04hudsonbotCheckin
2017-03-30 00:04hudsonbotNote Added: 0095683
2017-03-31 09:27alostaleNote Added: 0095747
2017-03-31 09:27alostaleStatusresolved => new
2017-03-31 09:27alostaleResolutionfixed => open
2017-03-31 09:53inigosanchezStatusnew => scheduled
2017-03-31 13:21hgbotCheckin
2017-03-31 13:21hgbotNote Added: 0095766
2017-03-31 13:21inigosanchezStatusscheduled => resolved
2017-03-31 13:21inigosanchezResolutionopen => fixed
2017-03-31 14:27alostaleNote Added: 0095769
2017-03-31 14:27alostaleStatusresolved => closed
2017-03-31 14:27alostaleFixed in Version => 3.0PR17Q2
2017-04-01 12:06hudsonbotCheckin
2017-04-01 12:06hudsonbotNote Added: 0095780

Notes
(0095354)
alostale   
2017-03-17 09:28   
Summary functions require to execute in DB the query that populates current grid without any pagination in order to perform the aggregation, this is known to be potentially problematic in performance, depending on the window and volume of data.

As computed columns allow to be defined with any arbitrary sql statement, the risk of underperformance when included in a summary function is much bigger.

Because of this, the proposal is to not support computed columns to be included as summary functions.
(0095607)
inigosanchez   
2017-03-28 15:49   
Added a test in testlink: Platform > Summary, Grouping and Filter > Summary > Disable Summary functions for Computed Columns
(0095614)
inigosanchez   
2017-03-28 17:57   
Updated wiki http://wiki.openbravo.com/wiki/User_Interface_Introduction#Grid_Summaries [^]
(0095628)
hgbot   
2017-03-29 09:46   
Repository: erp/devel/pi
Changeset: e10bc2fc5f83a9ebb3dcbdc6ce936e79756973ce
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Tue Mar 28 17:55:09 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/e10bc2fc5f83a9ebb3dcbdc6ce936e79756973ce [^]

Fixed issue 35536: Deactivated summary function in computed columns.

The summary functions didn't work as expected in computed columns.

As computed columns allow to be defined with any arbitrary sql statement,
the risk of underperformance when included in a summary function is much
bigger.

Because of this, to avoid this problem, it has been resolved by blocking
the use of the summary functions in computed columns.

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl
M modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFieldHandler.java
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
---
(0095683)
hudsonbot   
2017-03-30 00:04   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/8a8b60d9776c [^]
Maturity status: Test
(0095747)
alostale   
2017-03-31 09:27   
Reopening:

Before this fix it was possible to set a computed column as summary function. If having at least one computed column as summary the grid status was persisted or the view was saved, after the fix the columns still appears with its summary. Even worse, when in this situation it is not possible to manually remove summary because the contextual menu now does not allow it because it is computed.
(0095766)
hgbot   
2017-03-31 13:21   
Repository: erp/devel/pi
Changeset: dd9323a820c07e28dde4ed19a19c55cc6cb22863
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Fri Mar 31 13:20:15 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/dd9323a820c07e28dde4ed19a19c55cc6cb22863 [^]

Related with issue 35536: summary functions are not allowed in computed columns

The problem found in the code review was if having at least one computed column as summary
the grid status was persisted or the view was saved, after the fix the columns still
appears with its summary. This happened because the original fix did not take this scenario
into account. It means summary functions applied to computed columns in older versions are
not managed properly.

The problem has been resolved by take into account when a computed column had a summary
function defined in older versions. When take place this situation the summary function is
not displayed anymore. Besides, it is not possible to define a new summary function in a
computed column.

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
---
(0095769)
alostale   
2017-03-31 14:27   
code reviewed + tested
(0095780)
hudsonbot   
2017-04-01 12:06   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/44185ff76d75 [^]
Maturity status: Test