User Guide
  • Introduction
  • Overview
    • About 4WS.Platform
      • Architecture
      • Enterprise Edition
      • Tech specs and requirements
      • Warp SDK
    • Creating a web application
  • Core features
    • Tables
    • SqlTool
    • Definition of Data models and Relations
      • Relations
      • Reverse Engineering
      • Custom Fields
    • Defining business components
      • What are business components
      • Business components to fill-in panels
      • Creating business components
        • By a datastore entity
        • By a MongoDB collection
      • Defining Custom Java Business component
    • Defining the UI
      • App Designer
        • App Designer Menu
        • Definition of additional data sources
        • Panel containers and layouts
          • Tab panel
          • Alternative panel
          • Accordion panel
          • Vertical orientation panel
          • Horizontal orientation panel
          • Columns panel
          • Table panel
          • Generic panel
          • Responsive panel
        • Window content
          • Grid Panel
          • Form Panel
          • Filter Panel
          • Tree Panel
          • Google Map Panel
          • Preview Panel (old Image panel)
          • Tree + Grid Panel
          • Image Gallery
        • Windows list
        • Panel definition
          • Columns properties
          • Controls properties
          • Filter properties
          • Supported components
        • Variables
        • Code selectors
          • When not to use a dynamic combo-box
        • Smart Filter and Advanced Filter
        • Multi Value Combobox Filter
        • Multi Value Tree Filter
        • Buttons
        • Translations
          • Translations about GUI components and internationalization settings
          • Data coming from database
          • Custom code and translations
        • Application Menu
        • Bulk import binded to a grid
        • Range Date Filter
      • Web Interpreter
        • Grid components
        • Detail forms
        • Other components
        • Other features
          • Chat
        • Global variables
          • Client-side global variables
          • Server global variables
        • Forgot Password
    • Working with users and roles
      • Rule for roles
      • Permissions Administrator
    • Wizard
      • How to add a checkbox grid to select one or more rows
      • How to load a second grid when clicking on a row from the first grid
      • How to load a form when clicking on a row of the grid
      • How to open a window when double clicking on a row of the grid
      • How to open a window with right click on the popup menu
      • How to open a window when pressing a button on the grid toolbar
      • How to load a grid after loading a form
      • How to open a window when pressing a button on the form toolbar
      • How to load a grid when clicking on a tree node
      • How to load a form when clicking on a tree node
    • Defining events
      • Panel events
      • Column events
      • Control events
      • Filter events
      • Timer events
      • Start-End event
    • Server-side Javascript & Web Service
      • Server-side Javascript
      • Grid component filled by a server-side JS
      • Detail component filled by a server-side JS
      • How to define a server-side JavaScript action
      • Web service
  • Setting up the environment
    • How to install
    • Application parameters
    • Global parameters
  • Modules
    • Reports & Charts
      • Jasper Report + iReport
      • Online report
      • Docx templating
      • Charts
      • Pivot Grid
      • Multidimensional pivot grid
      • Data Export from SQL query
    • SSO
      • Identity management in Platform
        • Identity management on the internal Platform database
        • Identity management based on Google SSO
      • LDAP
        • LDAP support
        • Identity management based on LDAP and database
        • Identity management based on an embedded LDAP server used by Alfresco and or Activiti
        • Identity management based on a remote LDAP server to connect to Platform on the cloud
        • Connecting an LDAP server to Activiti BPM
        • Connecting an LDAP server to Alfresco ECM
      • Google SSO
        • Google SSO
        • Google OAuth2
        • Identity management based on Google SSO
      • Custom SSO
      • Firebase
    • Mobile
      • Mobile introduction
      • Offline vs Online
        • Server side features
        • Server side functionalities
        • Server side Platform features
        • Mobile app features
      • Mobile side specifics
        • Customizations
          • Custom theme editor
        • App Menu
        • Window content
          • Detail scrollable form
          • Scrollable paginated grid
          • Constraint layout
          • Constraint panel
          • Collection grid view
          • Preview panel (mobile)
        • Form Controls
      • Reference guide
      • Cleaning up data
      • How to
      • App deployment
        • App deployment for the iOS platform
        • App deployment for the Android platform
      • Style properties
      • Appendix : Synchronization flow
      • Translations
    • GSuite
      • Introduction
      • Client-side integration
      • GMail
      • Calendar
      • Drive
      • Contacts
    • Google Cloud Platform
      • Datastore
        • Google Datastore Introduction
        • How to create Datastore entities
      • Google Cloud Storage
    • Scheduler
      • Scheduler Introduction
      • Process settings
        • How to define a sequence of consecutive processes
        • How to define a Custom Java Business component
        • How to define a Grid Data Import
        • How to define a server-side Javascript action
      • Email notifications
      • Process executions
      • Manually start a scheduled process
      • Process input parameters
    • Queue Manager
    • Log & Analysis
      • Application Log
      • Log statistics
      • App analyzer
      • Table log
      • Threads
      • Sessions and heap memory
      • Heap memory analysis
      • Access Log
      • Datastore statistics
      • Total monthly costs with Google Datastore
      • Service Monitoring
        • Introduction
        • Defining a service to monitor
        • Notifications setup
        • Events automatically managed by Platform
        • Remote Platform servers
        • Knowledge base
        • Adding log programatically
        • Searching for logged data
        • Use cases
    • File Management
    • Export and Import of Metadata
      • Application Metadata Management
    • Trigger writing operations
    • Audit
    • BPM
      • BPMN Introduction
      • BPMN main parts
      • Activiti Setup
      • Platform integration
        • Processes
        • Models
        • Process instances
        • To-do list
        • Process history
      • Process Web Modeler
        • Model Creation
          • Start-End Event
          • Gateways
        • Supported objects
        • Start tasks and user tasks
        • Form properties
          • Important notes
          • Property types
        • Service tasks
          • Web service
          • SQL Query
          • SQL statement
        • Mail task
        • Script task
          • Example : how to get a value previously read from a SQL query
          • Example : how to get the current process instance id
        • Timer events
        • Subprocess and Call Activiti
      • Utility methods available in Platform
        • How to start a process from a JavaScript action
        • How to complete a user task from a JavaScript action
      • An example
        • Processes
        • Instances
        • Activities
        • History
    • Embedded CMS
    • ECM
      • Alfresco
        • Alfresco Introduction
        • Integration between 4WS.Platform and Alfresco
          • Integration at GUI level
          • Integration at model level
          • Integration at authentication and authorizations level
          • Additional features
        • How to use 4WS.Platform and Alfresco together
          • Set the same Identity Management system
          • Define document types and aspects in Alfresco
          • Import the document types and aspects definitions in 4WS.Platform
          • Define document types and aspects in 4WS.Platform
          • Reverse engineering of document types or aspects
          • Definition of business components to fill-in panels
          • Definition of the GUI
          • Additional server-side services
        • Requirements
        • Current limits in 4WS.Platform - Alfresco integration
      • Archiflow
        • Setup
        • Archiflow artifacts
        • How to
    • Lotus Notes Migration Tool
    • NoSQL databases
      • MongoDB
        • MongoDB Introduction
        • Setting up the environment
        • How to create collections
        • How to create business components
        • How to create windows filled with data coming from MongoDB collections
        • Design rules
      • Google Datastore
        • Google Datastore Introduction
        • Setting up the environment
        • How to create entities
        • How to create business components
        • How to create windows filled with data coming from Datastore entities
        • Design rules
    • TensorFlow
    • Web Page Development
      • Pure Web Page Development
      • Google Material Design development
      • Appendix A - a complete example without any lib
      • Appendix B - a complete example with Google MD
    • Jira Integration
    • Platform for GAE
    • SQL errors management
    • Multidimensional pivot grid
    • Quality
      • Automated Web Service Testing
      • Automated unit testing
      • Source code static analysis using ESlint
      • Source code static analysis using SonarQube
  • Troubleshootings
  • Best practises
    • Database design
    • Database maintenance
    • Creating a Web app : common use cases
    • Creating a mobile app : common use cases
Powered by GitBook
On this page

Was this helpful?

  1. Modules
  2. Reports & Charts

Pivot Grid

PreviousChartsNextMultidimensional pivot grid

Last updated 5 years ago

Was this helpful?

In this type of grid, columns can be grouped according to their usage/meaning. In order to make it clear, let’s see a typical example, where there is a table storing a list of order rows, where each row is related to products with variants, i.e. products having the same code but different variants, like color, size, etc.. Such a kind of table could have columns like these ones:

  • ROW_NUM (PRIMARY KEY)

  • ORDER_YEAR (FK TO ORDERS)

  • ORDER_NUM (FK TO ORDERS)

  • PRODUCT_CODE

  • COLOR_CODE

  • SIZE_CODE

  • QTY

  • UNIT_PRICE

For this example, PRODUCT_CODE and COLOR_CODE would be " pivot columns" , whereas SIZE_CODE would be the " identifying column " and QTY the " grouping column ". That means that multiple records related to the same combination ofPRODUCT_CODE and COLOR_CODE should be joined to a single raw, where the QTY is reported many times, one for each different value of SIZE_CODE. Basically, theSIZE_CODE is spread along the columns of the grid.

Moreover, records read from a table shoud be grouped not only by PRODUCT_CODE and COLOR_CODE, but also by ORDER_YEAR and ORDER_NUM. ROW_NUM is not needed to the grid, since it value changes according to the real record in the database: remember that N records stored in the database table are showed in a single row in grid (if they have the same PRODUCT_CODE and COLOR_CODE). Anyway, ROW_NUM must be declared as a "managed column", otherwise its value would not be generated when saving records to the database. Starting from this example, it is now time to see how to configure a pivot table. Once selected the "pivot grid" from the "Add window" wizard, the user has to define settings for the grid. In addition, for a pivot grid the user also has to define settings related to that grid component:

  • business component that defines the list of columns for pivot column group, the only field specified in the select clause is used to automatically create the pivot column (this setting is mandatory). The number of pivot columns is the count of the list of element of business component

  • business component that defines the header of pivot column group, the fields specified in the select clause are used to automatically set the header of pivot column, the fields specified are like , (comma); the first field in the select must be the code related to "identifying column" (in the example above, the CODE_SIZE); optionally, the select can contain a second field, which will be used to set the column headers with these values rather than the codes; if the second field in the select is not specified, the first will be used to set the column headers; that means the column headers are set with codes as default behavior and optionally they can be set with a description contained in the second field of the select clause.

Other fields are not considered.

Apart from these settings, required while creating the pivot grid component, it is needed to specify three additional settings in the list of columns:

  • the column named " Pivot Columns " requires to check at least one field to use as a pivot column, i.e. the list of fields that identify a single row in the grid except for the identifying field (i.e. they are used to group multiple records in one row in grid); for instance, if a row shows a list of sizes for a product having a specific item name and color, then the item code and color represent the pivot fields, whereas the size must be showed along the columns of the grid; the result is the execution of the SQL query linked to the grid with the additional group by clause composed by all the pivot fields.

Consequently, never define the identifying column as part of the “pivot columns”.

  • the column named " Aggregated column " represents the quantity to show for each column; in the example above, it can be a quantity or a price related to each size; you have to define at least one field as an aggregate column; all aggregated columns are mandatory.

  • the column named " Identifying Column " represents the field to show along the grid columns; in the example above, it is the size; consequently, the set of records read from the database and related to the same combination of item and color becomes one only row in grid, where each record reading becomes a specific size and the corresponding quantity is reported as its cell value.

Behind the scenes

When saving data in update, edited cell can lead to 3 scenarios:

  • the edited cell was empty and it was filled out with a number > 0; this is managed as an INSERT

  • the edited cell was not empty and with a value different from 0

    • and then cleared up or set to 0; this is managed as a DELETE

    • and then changed with another value different from 0; this is managed as an UPDATE

In order to correctly execute these operations, the grid must be configured by taking into account also mandatory values in the table where saving data:

  • in case of INSERT, you have to correctly set "default values in insert" for each mandatory field and these fields must be set as "to manage. In case the pk fields or other mandatory fields are not set starting from the UI or from default values (as for an internal counter), you can always use the "before save data in insert" event and link a server-side javascript action to fill in these values, through the method utils.setAttributeValue(attrName,value)

  • in case of UPDATE, you have to correctly set "default values in update" for each mandatory field not retrieved from the input, and these fields must be set as "to manage"; you have the chance to omit some fields (flag "to manage" set to false) for not mandatory fields: these fields will be ignored during the UPDATE operation, and the previous value would be maintained. In case other mandatory fields are not set starting from the UI or from default values, you can always use the "before save data in update" event and link a server-side javascript action to fill in these values, through the method utils.setAttributeValue(attrName,value)

  • for UPDATE/DELETE fields, you have to provide the values for the "real" primary key, otherwise it would be impossible to execute the operation. Behind the scenes, Platform always try to fetch the whole "real" record from the database, starting from the "pivot column values", which are considered "unique" and therefore they allow to get a single record from the database. The record fetched is used to fill in the pk in UPDATE/DELETE, if not included in the "pivot columns"; in case of UPDATE operation, the fetch operation is also used to fill in other fields (not belonging to the pk) and not available in the grid, but only for the fields marked as "to manage".