4D Blog

Home Tips 4D View Pro: Create a Pivot Table from a data table

4D View Pro: Create a Pivot Table from a data table

June 6, 2023

Tips

Pivot tables are among the most valuable features that allow users to swiftly summarize and analyze large quantities of data to see comparisons, patterns, and trends in their data. From the 4D v19, pivot tables are included in 4D View Pro. This blog post reviews how to use a pivot table through the ribbon interface.

The video below shows you how to create a pivot table with the ribbon. Each step is described below the video:

Add data

The first step is always to create a data source for your pivot table. In this blog post, we use data from a table in our database. To use it, we add a new sheet named “DataSource” and create in it a new table that contains the data:

$data:=New object("SalesSource"; ds.Sales.all().toCollection())

// Create a new sheet that contains the data
VP ADD SHEET(This.Area; 1; "DataSource")

// Data context creation
VP SET DATA CONTEXT(This.Area; $context; Null; 1)

// Creation of a table that will be used by the table as datasource
VP CREATE TABLE(VP Cell(This.Area; 0; 0; 1); This.TableName; $contextAttribut)

The data is now displayed in a table on the second worksheet in the workbook titled DataSource:

Add a Pivot Table

Now that we have our data in a table, we will add a pivot table. Select your source table in your document and click on the PivotTable button of the ribbon:

blank

It opens a window that allows you to choose where you want to put your pivot table:

blank

There is now a blank pivot table in a new worksheet of your document:

blank

Pivot table side panel

To activate the pivot table side panel, click on the pivot table area, and drag and drop your fields as you need:

blank

Below is an example of a pivot table that you can obtain:

blank

Take a look at the SpreadJS documentation to find all the ways to manage your pivot tables.

Discuss

Tags 4D View Pro, Data context, Data table, Spreadsheet, v19, v20

Latest related posts

  • September 15, 2025

    Find the right spot in your 4D Write Pro document with AI

  • September 2, 2025

    Intelligent 4D Write Pro document analysis with AI

  • August 25, 2025

    ORDA – Constructor and touched event – Detailed behaviour through a network

Fabrice Mainguené
Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • AI
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2026 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy