← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12594: Add filter fields for favorites of tabularreport.

 

------------------------------------------------------------
revno: 12594
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-10-11 22:37:29 +0700
message:
  Add filter fields for favorites of tabularreport.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReport.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java
  dhis-2/dhis-services/dhis-service-eventreporting/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientAggregateReport.hbm.xml
  dhis-2/dhis-services/dhis-service-eventreporting/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetAggregateReportAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveAggregateReportAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularAggregateReport.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReport.java	2013-10-08 03:23:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAggregateReport.java	2013-10-11 15:37:29 +0000
@@ -62,6 +62,8 @@
 
     private List<String> dimension = new ArrayList<String>();
 
+    private List<String> filter = new ArrayList<String>();
+
     private String ouMode;
 
     private String aggregateType = "count";
@@ -107,7 +109,7 @@
     {
         this.aggregateType = aggregateType;
     }
-    
+
     public Program getProgram()
     {
         return program;
@@ -178,4 +180,13 @@
         this.sortOrder = sortOrder;
     }
 
+    public List<String> getFilter()
+    {
+        return filter;
+    }
+
+    public void setFilter( List<String> filter )
+    {
+        this.filter = filter;
+    }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java	2013-10-09 11:26:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java	2013-10-11 15:37:29 +0000
@@ -77,6 +77,8 @@
 
     private List<String> dimension = new ArrayList<String>();
 
+    private List<String> filter = new ArrayList<String>();
+
     private String ouMode;
 
     // -------------------------------------------------------------------------
@@ -123,8 +125,8 @@
     }
 
     @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlElementWrapper( localName = "items", namespace = DxfNamespaces.DXF_2_0 )
-    @JacksonXmlProperty( localName = "items", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlElementWrapper( localName = "dimension", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "dimension", namespace = DxfNamespaces.DXF_2_0 )
     public List<String> getDimension()
     {
         return dimension;
@@ -135,6 +137,19 @@
         this.dimension = dimension;
     }
 
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlElementWrapper( localName = "filter", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "filter", namespace = DxfNamespaces.DXF_2_0 )
+    public List<String> getFilter()
+    {
+        return filter;
+    }
+
+    public void setFilter( List<String> filter )
+    {
+        this.filter = filter;
+    }
+
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class } )
     @JsonSerialize( as = BaseIdentifiableObject.class )

=== modified file 'dhis-2/dhis-services/dhis-service-eventreporting/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientAggregateReport.hbm.xml'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientAggregateReport.hbm.xml	2013-10-08 03:23:55 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientAggregateReport.hbm.xml	2013-10-11 15:37:29 +0000
@@ -28,8 +28,14 @@
 
 		<property name="endDate" />
 		
-		<list name="dimension" table="patientaggregatereportmembers">
-	      <key column="patientaggregatereportid" foreign-key="fk_patientaggregatereportid_items" />
+		<list name="dimension" table="patientaggregatereport_dimension">
+	      <key column="patientaggregatereportid" foreign-key="fk_patientaggregatereportid_dimensions" />
+	      <list-index column="sort_order" />
+	      <element type="text" column="itemvalue" />
+	    </list>
+	    
+	    <list name="filter" table="patientaggregatereport_filters">
+	      <key column="patientaggregatereportid" foreign-key="fk_patientaggregatereportid_filters" />
 	      <list-index column="sort_order" />
 	      <element type="text" column="itemvalue" />
 	    </list>

=== modified file 'dhis-2/dhis-services/dhis-service-eventreporting/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml	2013-10-08 03:23:55 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml	2013-10-11 15:37:29 +0000
@@ -28,12 +28,18 @@
 
 		<property name="endDate" />
 		
-		<list name="dimension" table="patienttabularreportmembers">
-	      <key column="patienttabularreportid" foreign-key="fk_patienttabularreportid_items" />
+		<list name="dimension" table="patienttabularreport_dimensions">
+	      <key column="patienttabularreportid" foreign-key="fk_patienttabularreportidid_dimensions" />
 	      <list-index column="sort_order" />
 	      <element type="text" column="itemvalue" />
 	    </list>
 		
+	    <list name="filter" table="patienttabularreport_filters">
+	      <key column="patienttabularreportid" foreign-key="fk_patienttabularreportid_filters" />
+	      <list-index column="sort_order" />
+	      <element type="text" column="itemvalue" />
+	    </list>
+	    
 		<property name="ouMode" />
 
 		<!-- Access properties -->

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetAggregateReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetAggregateReportAction.java	2013-10-08 03:59:38 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetAggregateReportAction.java	2013-10-11 15:37:29 +0000
@@ -126,25 +126,46 @@
         return programStage;
     }
 
-    private List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();
-
-    public List<PatientIdentifierType> getIdentifierTypes()
-    {
-        return identifierTypes;
-    }
-
-    private List<PatientAttribute> attributes = new ArrayList<PatientAttribute>();
-
-    public List<PatientAttribute> getAttributes()
-    {
-        return attributes;
-    }
-
-    private List<DataElement> dataElements = new ArrayList<DataElement>();
-
-    public List<DataElement> getDataElements()
-    {
-        return dataElements;
+    private List<PatientIdentifierType> dimensionIdentifierTypes = new ArrayList<PatientIdentifierType>();
+
+    public List<PatientIdentifierType> getDimensionIdentifierTypes()
+    {
+        return dimensionIdentifierTypes;
+    }
+
+    private List<PatientIdentifierType> filterIdentifierTypes = new ArrayList<PatientIdentifierType>();
+
+    public List<PatientIdentifierType> getFilterIdentifierTypes()
+    {
+        return filterIdentifierTypes;
+    }
+
+    private List<PatientAttribute> dimensionAttributes = new ArrayList<PatientAttribute>();
+
+    public List<PatientAttribute> getDimensionAttributes()
+    {
+        return dimensionAttributes;
+    }
+
+    private List<PatientAttribute> filterAttributes = new ArrayList<PatientAttribute>();
+
+    public List<PatientAttribute> getFilterAttributes()
+    {
+        return filterAttributes;
+    }
+
+    private List<DataElement> dimensionDataElements = new ArrayList<DataElement>();
+
+    public List<DataElement> getDimensionDataElements()
+    {
+        return dimensionDataElements;
+    }
+
+    private List<DataElement> filterDataElements = new ArrayList<DataElement>();
+
+    public List<DataElement> getFilterDataElements()
+    {
+        return filterDataElements;
     }
 
     private Map<String, String> mapFilters = new HashMap<String, String>();
@@ -188,11 +209,15 @@
         Program program = aggregateReport.getProgram();
 
         programStage = aggregateReport.getProgramStage();
-        
+
+        // ---------------------------------------------------------------------
+        // Get dimensions
+        // ---------------------------------------------------------------------
+
         for ( String dimension : aggregateReport.getDimension() )
         {
             String dimensionId = DataQueryParams.getDimensionFromParam( dimension );
-           
+
             String[] filters = dimension.split( DataQueryParams.DIMENSION_NAME_SEP );
             if ( filters.length > 1 )
             {
@@ -237,25 +262,61 @@
 
                 if ( it != null && program.getPatientIdentifierTypes().contains( it ) )
                 {
-                    identifierTypes.add( it );
+                    dimensionIdentifierTypes.add( it );
                 }
 
                 PatientAttribute at = patientAttributeService.getPatientAttribute( dimensionId );
 
                 if ( at != null && program.getPatientAttributes().contains( at ) )
                 {
-                    attributes.add( at );
+                    dimensionAttributes.add( at );
                 }
 
                 DataElement de = dataElementService.getDataElement( dimensionId );
 
                 if ( de != null && program.getAllDataElements().contains( de ) )
                 {
-                    dataElements.add( de );
+                    dimensionDataElements.add( de );
                 }
             }
         }
 
+        // ---------------------------------------------------------------------
+        // Get filters
+        // ---------------------------------------------------------------------
+
+        for ( String filter : aggregateReport.getFilter() )
+        {
+            String filterId = DataQueryParams.getDimensionFromParam( filter );
+
+            String[] filters = filter.split( DataQueryParams.DIMENSION_NAME_SEP );
+            if ( filters.length > 1 )
+            {
+                mapFilters.put( filterId, filter.substring( filterId.length() + 1, filter.length() ) );
+            }
+
+            PatientIdentifierType it = patientIdentifierTypeService.getPatientIdentifierType( filterId );
+
+            if ( it != null && program.getPatientIdentifierTypes().contains( it ) )
+            {
+                filterIdentifierTypes.add( it );
+            }
+
+            PatientAttribute at = patientAttributeService.getPatientAttribute( filterId );
+
+            if ( at != null && program.getPatientAttributes().contains( at ) )
+            {
+                filterAttributes.add( at );
+            }
+
+            DataElement de = dataElementService.getDataElement( filterId );
+
+            if ( de != null && program.getAllDataElements().contains( de ) )
+            {
+                filterDataElements.add( de );
+            }
+        }
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java	2013-10-08 03:59:38 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java	2013-10-11 15:37:29 +0000
@@ -125,25 +125,53 @@
         return programStage;
     }
 
-    private List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();
-
-    public List<PatientIdentifierType> getIdentifierTypes()
-    {
-        return identifierTypes;
-    }
-
-    private List<PatientAttribute> attributes = new ArrayList<PatientAttribute>();
-
-    public List<PatientAttribute> getAttributes()
-    {
-        return attributes;
-    }
-
-    private List<DataElement> dataElements = new ArrayList<DataElement>();
-
-    public List<DataElement> getDataElements()
-    {
-        return dataElements;
+    private List<PatientIdentifierType> dimensionIdentifierTypes = new ArrayList<PatientIdentifierType>();
+
+    public List<PatientIdentifierType> getDimensionIdentifierTypes()
+    {
+        return dimensionIdentifierTypes;
+    }
+
+    private List<PatientIdentifierType> filterIdentifierTypes = new ArrayList<PatientIdentifierType>();
+
+    public List<PatientIdentifierType> getFilterIdentifierTypes()
+    {
+        return filterIdentifierTypes;
+    }
+
+    private List<PatientAttribute> dimensionAttributes = new ArrayList<PatientAttribute>();
+
+    public List<PatientAttribute> getDimensionAttributes()
+    {
+        return dimensionAttributes;
+    }
+
+    private List<PatientAttribute> filterAttributes = new ArrayList<PatientAttribute>();
+
+    public List<PatientAttribute> getFilterAttributes()
+    {
+        return filterAttributes;
+    }
+
+    private List<DataElement> dimensionDataElements = new ArrayList<DataElement>();
+
+    public List<DataElement> getDimensionDataElements()
+    {
+        return dimensionDataElements;
+    }
+
+    private List<DataElement> filterDataElements = new ArrayList<DataElement>();
+
+    public List<DataElement> getFilterDataElements()
+    {
+        return filterDataElements;
+    }
+
+    private Map<String, String> mapFilters = new HashMap<String, String>();
+
+    public Map<String, String> getMapFilters()
+    {
+        return mapFilters;
     }
 
     private Collection<OrganisationUnit> orgunits = new HashSet<OrganisationUnit>();
@@ -167,12 +195,6 @@
         return userOrgunitChildren;
     }
 
-    private Map<String, String> mapFilters = new HashMap<String, String>();
-
-    public Map<String, String> getMapFilters()
-    {
-        return mapFilters;
-    }
 
     // -------------------------------------------------------------------------
     // Action implementation
@@ -220,24 +242,61 @@
 
                 if ( it != null && program.getPatientIdentifierTypes().contains( it ) )
                 {
-                    identifierTypes.add( it );
+                    dimensionIdentifierTypes.add( it );
                 }
 
                 PatientAttribute at = patientAttributeService.getPatientAttribute( dimensionId );
 
                 if ( at != null && program.getPatientAttributes().contains( at ) )
                 {
-                    attributes.add( at );
+                    dimensionAttributes.add( at );
                 }
 
                 DataElement de = dataElementService.getDataElement( dimensionId );
 
                 if ( de != null && program.getAllDataElements().contains( de ) )
                 {
-                    dataElements.add( de );
+                    dimensionDataElements.add( de );
                 }
             }
         }
+        
+     // ---------------------------------------------------------------------
+        // Get filters
+        // ---------------------------------------------------------------------
+
+        for ( String filter : tabularReport.getFilter() )
+        {
+            String filterId = DataQueryParams.getDimensionFromParam( filter );
+
+            String[] filters = filter.split( DataQueryParams.DIMENSION_NAME_SEP );
+            if ( filters.length > 1 )
+            {
+                mapFilters.put( filterId, filter.substring( filterId.length() + 1, filter.length() ) );
+            }
+
+            PatientIdentifierType it = patientIdentifierTypeService.getPatientIdentifierType( filterId );
+
+            if ( it != null && program.getPatientIdentifierTypes().contains( it ) )
+            {
+                filterIdentifierTypes.add( it );
+            }
+
+            PatientAttribute at = patientAttributeService.getPatientAttribute( filterId );
+
+            if ( at != null && program.getPatientAttributes().contains( at ) )
+            {
+                filterAttributes.add( at );
+            }
+
+            DataElement de = dataElementService.getDataElement( filterId );
+
+            if ( de != null && program.getAllDataElements().contains( de ) )
+            {
+                filterDataElements.add( de );
+            }
+        }
+        
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveAggregateReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveAggregateReportAction.java	2013-10-08 03:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveAggregateReportAction.java	2013-10-11 15:37:29 +0000
@@ -104,6 +104,8 @@
 
     private List<String> dimension = new ArrayList<String>();
 
+    private List<String> filter = new ArrayList<String>();
+
     private String ouMode;
 
     private Integer limit;
@@ -154,6 +156,11 @@
         this.programStageId = programStageId;
     }
 
+    public void setFilter( List<String> filter )
+    {
+        this.filter = filter;
+    }
+
     public void setDimension( List<String> dimension )
     {
         this.dimension = dimension;
@@ -176,12 +183,13 @@
         aggregateReport.setOuMode( ouMode );
         aggregateReport.setUser( currentUserService.getCurrentUser() );
         aggregateReport.setDimension( dimension );
+        aggregateReport.setFilter( filter );
         aggregateReport.setProgramStage( programStage );
         aggregateReport.setProgram( program );
         aggregateReport.setLimit( limit );
         aggregateReport.setSortOrder( sortOrder );
         aggregateReport.setUser( currentUserService.getCurrentUser() );
-        
+
         aggregateReportService.addPatientAggregateReport( aggregateReport );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java	2013-10-08 03:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java	2013-10-11 15:37:29 +0000
@@ -104,6 +104,8 @@
     private String endDate;
 
     private List<String> dimension = new ArrayList<String>();
+    
+    private List<String> filter = new ArrayList<String>();
 
     private String ouMode;
 
@@ -141,6 +143,11 @@
         this.programStageId = programStageId;
     }
 
+    public void setFilter( List<String> filter )
+    {
+        this.filter = filter;
+    }
+
     public void setDimension( List<String> dimension )
     {
         this.dimension = dimension;
@@ -163,6 +170,7 @@
         tabularReport.setOuMode( ouMode );
         tabularReport.setUser( currentUserService.getCurrentUser() );
         tabularReport.setDimension( dimension );
+        tabularReport.setFilter( filter );
         tabularReport.setProgramStage( programStage );
         tabularReport.setProgram( program );
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-10-11 13:49:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-10-11 15:37:29 +0000
@@ -439,7 +439,7 @@
 					subPanel = Ext.getCmp(panelid);
 				}
 				else {
-					idx = subPanel.items.length/4;
+					idx = subPanel.items.length/5;
 				}
 				
 				var items = [];
@@ -468,6 +468,7 @@
 				else
 				{
 					items[3] = this.removeFieldBtn( panelid, fieldid );
+					items[4] = {};
 				}
 				
 				subPanel.add(items);
@@ -1128,6 +1129,10 @@
 										var valueType = f.items[i].valueType;
 										TR.store.dataelement.selected.add({id: id, name: name, valueType: valueType});
 										TR.util.multiselect.addFilterField( 'filterPanel', id, name, valueType, f.filters[id] );
+										var dimension = f.items[i].dimension;
+										if(dimension=='false'){
+											Ext.getCmp('filter_dimension_' + id).setValue( 'filter' );
+										}
 									}
 									
 									if( f.singleEvent == 'false' )
@@ -1137,6 +1142,10 @@
 										if (TR.util.store.containsParent(store)) {
 											TR.util.store.loadFromStorage(store);
 											TR.util.multiselect.filterAvailable(TR.cmp.params.dataelement.available, TR.cmp.params.dataelement.selected);
+											var dimension = f.items[i].dimension;
+											if(dimension=='false'){
+												Ext.getCmp('filter_dimension_' + id).setValue( 'filter' );
+											}
 										}
 										else {
 											store.load({params: {programStageId: f.programStageId}});
@@ -1263,6 +1272,10 @@
 										TR.store.dataelement.selected.add({id: id, name: name, valueType: valueType});
 										
 										TR.util.multiselect.addFilterField( 'filterPanel', id, name, valueType, f.filters[id] );
+										var dimension = f.items[i].dimension;
+										if(dimension=='false'){
+											Ext.getCmp('filter_dimension_' + id).setValue( 'filter' );
+										}
 									}
 									
 									if( f.singleEvent == 'false' )
@@ -1272,6 +1285,10 @@
 										if (TR.util.store.containsParent(store)) {
 											TR.util.store.loadFromStorage(store);
 											TR.util.multiselect.filterAvailable(TR.cmp.params.dataelement.available, TR.cmp.params.dataelement.selected);
+											var dimension = f.items[i].dimension;
+											if(dimension=='false'){
+												Ext.getCmp('filter_dimension_' + id).setValue( 'filter' );
+											}
 										}
 										else {
 											store.load({params: {programStageId: f.programStageId}});
@@ -1616,11 +1633,14 @@
 			p.startDate = TR.cmp.settings.startDate.rawValue;
 			p.endDate = TR.cmp.settings.endDate.rawValue;
 			
-			if( TR.cmp.settings.ouMode.getValue()!== null ){
+			if( TR.cmp.settings.ouMode.getValue()!== null ||  TR.cmp.settings.ouMode.getValue()!='' ){
 				p.ouMode = TR.cmp.settings.ouMode.getValue();
 			}
 			
 			// Paging
+			if(TR.state.currentPage==undefined){
+				TR.state.currentPage = 1;
+			}
 			p.page = TR.state.currentPage;
 			
 			// Get searching values
@@ -1657,7 +1677,7 @@
 			TR.cmp.params.dataelement.selected.store.each( function(r) {
 				var valueType = r.data.valueType;
 				var deId = r.data.id;
-				var length = Ext.getCmp('filterPanel_' + deId).items.length/4;
+				var length = Ext.getCmp('filterPanel_' + deId).items.length/5;
 				var hidden = TR.state.caseBasedReport.isColHidden(deId);
 				var dimensionOption = 'dimension';
 				
@@ -1778,12 +1798,17 @@
 			TR.cmp.params.dataelement.selected.store.each( function(r) {
 				var valueType = r.data.valueType;
 				var deId = r.data.id;
-				var length = Ext.getCmp('filterPanel_' + deId).items.length/4;
+				var length = Ext.getCmp('filterPanel_' + deId).items.length/45;
 				var hidden = TR.state.caseBasedReport.isColHidden(deId);
-				
+				var dimensionOption = 'dimension';
+
 				for(var idx=0;idx<length;idx++)
 				{
 					var id = deId + '_' + idx;
+					if( idx==0 )
+					{
+						dimensionOption = Ext.getCmp('filter_dimension_' + deId ).getValue();
+					}
 					
 					var filterOpt = Ext.getCmp('filter_opt_' + id).getValue();						
 					var filterValue = Ext.getCmp('filter_' + id).rawValue;
@@ -1803,7 +1828,12 @@
 						}
 					}
 					
-					params += '&dimension=' + filter;
+					if( dimensionOption=='dimension' ){
+						params += '&dimension=' + filter;
+					}
+					else{
+						params += '&filter=' + filter;
+					}
 				}
 			});
 			

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularAggregateReport.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularAggregateReport.vm	2013-10-08 03:23:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularAggregateReport.vm	2013-10-11 15:37:29 +0000
@@ -46,45 +46,86 @@
 		#end
 	],
 	"items": [
-		#set( $size = $identifierTypes.size() )
-		#foreach( $item in $identifierTypes )
-			{
-				"id": "$item",
-				"name": "",
-				"compulsory": "",
-				"valueType": #if( $iden.optionSet )
-								"list"
-							 #else
-								"${iden.type}"
-							 #end
-			},
-		#end
-		
-		
-		#foreach( $attr in $attributes )
-		{
-			"id": "$attr.uid",
-			"name": "$encoder.xmlEncode(${attr.displayName} )",
-			"valueType": #if( $attr.optionSet )
-							"list"
-						 #else
-							"${attr.type}"
-						 #end
-		},
-		#end
-		
-		#foreach( $de in $dataElements )
-		{
-			"id": "$de.uid",
-			"name": "$encoder.xmlEncode(${de.getFormNameFallback()} )",
-			"valueType": #if( $de.optionSet )
-							"list_$de.optionSet.uid"
-						 #else
-							"$de.type"
-						 #end
-		}#if( $velocityCount < $dataElements.size() ),#end
-		#end
-		
+		#foreach( $item in $dimensionIdentifierTypes )
+			{
+				"id": "$item",
+				"name": "",
+				"compulsory": "",
+				"valueType": #if( $iden.optionSet )
+								"list"
+							 #else
+								"${iden.type}"
+							 #end,
+				"dimension": "true"
+			},
+		#end
+		
+		
+		#foreach( $attr in $dimensionAttributes )
+		{
+			"id": "$attr.uid",
+			"name": "$encoder.xmlEncode(${attr.displayName} )",
+			"valueType": #if( $attr.optionSet )
+							"list"
+						 #else
+							"${attr.type}"
+						 #end,
+			"dimension": "true"
+		},
+		#end
+		
+		#foreach( $de in $dimensionDataElements )
+		{
+			"id": "$de.uid",
+			"name": "$encoder.xmlEncode(${de.getFormNameFallback()} )",
+			"valueType": #if( $de.optionSet )
+							"list_$de.optionSet.uid"
+						 #else
+							"$de.type"
+						 #end,
+			"dimension": "true"
+		},
+		#end
+		
+		#foreach( $item in $filterIdentifierTypes )
+			{
+				"id": "$item",
+				"name": "",
+				"compulsory": "",
+				"valueType": #if( $iden.optionSet )
+								"list"
+							 #else
+								"${iden.type}"
+							 #end,
+			"dimension": "false"
+			},
+		#end
+		
+		#foreach( $attr in $filterAttributes )
+		{
+			"id": "$attr.uid",
+			"name": "$encoder.xmlEncode(${attr.displayName} )",
+			"valueType": #if( $attr.optionSet )
+							"list"
+						 #else
+							"${attr.type}"
+						 #end,
+			"dimension": "false"
+		},
+		#end
+		
+		#foreach( $de in $filterDataElements )
+		{
+			"id": "$de.uid",
+			"name": "$encoder.xmlEncode(${de.getFormNameFallback()} )",
+			"valueType": #if( $de.optionSet )
+							"list_$de.optionSet.uid"
+						 #else
+							"$de.type"
+						 #end,
+			"dimension": "false"
+		}#if( $velocityCount < $filterDataElements.size() ),#end
+		#end
 	],
 	filters:{
 		#foreach( $de in $mapFilters.keySet() )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm	2013-10-08 03:59:38 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReport.vm	2013-10-11 15:37:29 +0000
@@ -43,44 +43,86 @@
 		#end
 	],
 	"items": [
-		#set( $size = $identifierTypes.size() )
-		#foreach( $item in $identifierTypes )
-			{
-				"id": "$item",
-				"name": "",
-				"compulsory": "",
-				"valueType": #if( $iden.optionSet )
-								"list"
-							 #else
-								"${iden.type}"
-							 #end
-			},
-		#end
-		
-		#foreach( $attr in $attributes )
-		{
-			"id": "$attr.uid",
-			"name": "$encoder.xmlEncode(${attr.displayName} )",
-			"valueType": #if( $attr.optionSet )
-							"list"
-						 #else
-							"${attr.type}"
-						 #end
-		},
-		#end
-		
-		#foreach( $de in $dataElements )
-		{
-			"id": "$de.uid",
-			"name": "$encoder.xmlEncode(${de.getFormNameFallback()} )",
-			"valueType": #if( $de.optionSet )
-							"list_$de.optionSet.uid"
-						 #else
-							"$de.type"
-						 #end
-		}#if( $velocityCount < $dataElements.size() ),#end
-		#end
-		
+		#foreach( $item in $dimensionIdentifierTypes )
+			{
+				"id": "$item",
+				"name": "",
+				"compulsory": "",
+				"valueType": #if( $iden.optionSet )
+								"list"
+							 #else
+								"${iden.type}"
+							 #end,
+				"dimension": "true"
+			},
+		#end
+		
+		
+		#foreach( $attr in $dimensionAttributes )
+		{
+			"id": "$attr.uid",
+			"name": "$encoder.xmlEncode(${attr.displayName} )",
+			"valueType": #if( $attr.optionSet )
+							"list"
+						 #else
+							"${attr.type}"
+						 #end,
+			"dimension": "true"
+		},
+		#end
+		
+		#foreach( $de in $dimensionDataElements )
+		{
+			"id": "$de.uid",
+			"name": "$encoder.xmlEncode(${de.getFormNameFallback()} )",
+			"valueType": #if( $de.optionSet )
+							"list_$de.optionSet.uid"
+						 #else
+							"$de.type"
+						 #end,
+			"dimension": "true"
+		},
+		#end
+		
+		#foreach( $item in $filterIdentifierTypes )
+			{
+				"id": "$item",
+				"name": "",
+				"compulsory": "",
+				"valueType": #if( $iden.optionSet )
+								"list"
+							 #else
+								"${iden.type}"
+							 #end,
+			"dimension": "false"
+			},
+		#end
+		
+		#foreach( $attr in $filterAttributes )
+		{
+			"id": "$attr.uid",
+			"name": "$encoder.xmlEncode(${attr.displayName} )",
+			"valueType": #if( $attr.optionSet )
+							"list"
+						 #else
+							"${attr.type}"
+						 #end,
+			"dimension": "false"
+		},
+		#end
+		
+		#foreach( $de in $filterDataElements )
+		{
+			"id": "$de.uid",
+			"name": "$encoder.xmlEncode(${de.getFormNameFallback()} )",
+			"valueType": #if( $de.optionSet )
+							"list_$de.optionSet.uid"
+						 #else
+							"$de.type"
+						 #end,
+			"dimension": "false"
+		}#if( $velocityCount < $filterDataElements.size() ),#end
+		#end
 	],
 	filters:{
 		#foreach( $de in $mapFilters.keySet() )