0.4 · The concept of analysis (database)

Level 0 · Getting started & environment

0.4The concept of analysis (database)

Goal: Understand the analysis (data model), data files (tables), items (fields) and keys.
Estimated time: 11 min · self-paced reading · If you only have 5 min: read “The essentials in 30s” + the diagram.

The essentials in 30 seconds

  • The analysis is the model (schema) of the database; WinDev vocabulary: file = table, item = column, link = relationship.
  • Everything follows from it: RAD generates windows and reports from the analysis, and fields bind to items.
  • Primary key = unique identifier; golden rule: take care of the analysis before drawing the windows.

Mini-case thread — Yacine draws the analysis of his trading business

Before drawing the slightest window, Yacine designs the analysis of his electrical equipment trading management application in Oran. In the analysis editor, he creates the files corresponding to his business entities: Customer, Product, Order, OrderLine, Invoice and Stock. For each one, he describes the items (name, type, size) — CodeClient, Nom, Ville; Reference, Designation, PrixUnitaireHT; NumeroCommande, DateCommande, CodeClient — and sets the primary key (the unique identifier, often automatic). He then draws the links that translate the real rules: a customer places several orders, an order contains several lines, an order produces one invoice. He keeps the golden rule in mind: if the analysis is shaky, everything that follows (windows, queries, reports) will be shaky too — and fixing it afterwards costs a lot.

Standalone case for this section: it returns in the course, the diagram, the script and the 48h challenge of section 0.4.

1. The analysis, data model

The analysis is THE central concept of WinDev: it is the description of the data structure, in other words the model (schema) of the database. There you describe the files (the equivalent of “tables”), the items (the equivalent of “columns”) and the links (the relationships between files). Watch out for PC SOFT's own vocabulary: what other tools call table / column / relationship is called here file / item / link. Yacine describes customers, products, orders and stock there.

2. Why everything follows from it

The analysis is decisive because everything follows from it. RAD relies on it and can generate windows, reports and code from it. The fields of the windows bind directly to the items: input, reading and saving become almost automatic. Queries and reports rest on the files and links. A correct model saves an enormous amount of time; a shaky model contaminates the whole application, as Yacine observes.

3. Primary key, links and golden rule

Two fundamental notions: the primary key (the item that uniquely identifies each record, often an automatic identifier) and the links, which express the real business relationships (a customer has several orders). Golden rule: take care of the analysis BEFORE drawing the windows. It is the most profitable investment of the whole project: fixing a structure afterwards forces you to redo windows, queries, reports and code, and to migrate existing data.

Common misinterpretation: "The analysis is a simple decorative diagram, and you can redo it after building the windows." No, that is a double mistake. The analysis is the foundation on which everything depends: RAD, bound fields, queries and reports. Changing it once the windows are created triggers a domino effect — and as soon as real data exists, a risky migration. Yacine therefore designs the analysis first, then builds the rest on top of it.
Yacine's analysis Files, items, links: the foundation of the application. CustomerCodeClient, Nom, Ville, Solde+ProductReference, Designation, Stock+OrderNumero, Date, CodeClient+LinksCustomer → Order → Invoice WinDev vocabulary: file = table, item = column, link = relationship.
Files, items, links: the foundation of the application.
Text version of the diagram (SEO / screen readers / translation): 1) Before any window, Yacine designs the analysis of his electrical equipment management application in Oran. 2) He creates the Customer, Product, Order, OrderLine, Invoice and Stock files, describes their items (name, type, size) and sets the primary key of each. 3) He draws the business links: a customer places several orders, an order contains several lines, an order produces one invoice. Lesson: WinDev vocabulary file = table, item = column, link = relationship; everything follows from the analysis, which must be taken care of before the windows.

🔎 Concrete example — 🔎 Concrete example — browsing a customer's orders

Thanks to the Customer → Order link, Yacine lists the orders of the customer being searched for:

// List the orders of the selected customer (1-N link)
TableSupprimeTout(TAB_Commandes)
POUR TOUT Commande
	SI Commande.CodeClient = Client.CodeClient ALORS
		TableAjouteLigne(TAB_Commandes, Commande.Numero, Commande.DateCommande, Commande.MontantHT)
	FIN
FIN

Reading: the link translates the rule “a customer has several orders” and allows navigation between files.

Lesson: a good link prevents duplicates and wrong totals — the worst bugs, because they do not crash, they lie.

Section vocabulary

Analysis
Model (schema) of the database: description of the data structure.

Simple example: Yacine describes his customers, products and orders there.

What it is not: an input window of the application.

Reflex: data structure → analysis.

File (= table)
Set of records of the same nature in the analysis (e.g. the Customer file).

Simple example: Yacine creates the Product file.

What it is not: a document on the hard disk.

Reflex: data table → file.

Item (= column)
Elementary piece of information described in a file, with a name, a type and a size.

Simple example: Yacine describes the Stock item as a numeric type.

What it is not: an entire window of the application.

Reflex: table column → item.

Link (= relationship)
Connection between two files expressing a business reality and ensuring consistency.

Simple example: A customer has several orders at Yacine's.

What it is not: a simple field color.

Reflex: business relationship → link.

Primary key
Item uniquely identifying each record of a file (often automatic).

Simple example: Yacine sets CodeClient as the primary key.

What it is not: an item with no identification role.

Reflex: unique identifier → primary key.

In practice — In practice — understanding and creating an analysis

  1. Open the analysis editor and create your files (= tables) corresponding to your business entities: Customer, Product, Order…
  2. Describe the items of each file (name, type, size), choosing the right type for each piece of information.
  3. Define the primary key of each file (often an automatic identifier) to identify each record.
  4. Draw the links between files, translating the real business rules (as Yacine does between Customer and Order), then generate the analysis before building the windows.
You have a correct data model, like Yacine's analysis — the backbone of the application — on which RAD, windows, queries and reports will rely.

Step-by-step script — describing Yacine's analysis

// Analysis of Yacine's trading management application // Customer file : CodeClient (primary key), Nom, Ville, Solde // Product file : Reference (primary key), Designation, Stock // Order file : Numero (primary key), DateCommande, CodeClient // Invoice file : NumeroFacture (primary key), NumeroCommande // Links: Customer → Order → Invoice; Order → OrderLine // Golden rule: generate the analysis BEFORE drawing the windows

The vocabulary is WinDev's own: file = table, item = column, link = relationship.

Copy-paste template — adding a customer (automatic primary key)

// Yacine's template — BTN_Ajouter button of the FEN_Clients window
HRAZ(Client)
Client.Nom = SAI_Nom
Client.Ville = SAI_Ville
Client.Telephone = SAI_Telephone
Client.Solde = 0
HAjoute(Client)
Info("Client ajouté, code = " + Client.CodeClient)

Business files

Yacine creates Customer, Product, Order, OrderLine, Invoice and Stock in the analysis.

Primary key

Yacine sets CodeClient as the unique identifier, often automatic.

Business link

Yacine translates the rule “a customer has several orders” as a 1-N link.

Golden rule

Yacine completes and generates the analysis before drawing the first window.

✓ Best practices

  • Start from the business: each file corresponds to a real entity.
  • Set a primary key per file (often automatic).
  • Take care of the analysis before the windows: it is the most profitable investment.

✗ Common pitfalls

  • Confusing a file in the analysis with a file on disk.
  • Drawing the windows before the analysis is stable.
  • Neglecting the links: duplicates and wrong totals follow.

Key takeaways

  • The analysis is the database model: files (= tables), items (= columns), links (= relationships).
  • Everything follows from it: RAD generates windows and reports from the analysis, and fields bind to items.
  • The primary key uniquely identifies each record; links translate business rules.
  • Golden rule: take care of the analysis before drawing the windows.

48h challenge — apply it tomorrow

Like Yacine, draw a mini-analysis on paper: three or four files (e.g. Customer, Product, Order), their main items with a type, a primary key per file and at least one link translating a business rule. Do not touch the windows yet: the exercise is to think about the model before the interface.

Section exit checklist
  • I know what the analysis is and its vocabulary (file, item, link).
  • I understand why everything follows from the analysis in WinDev.
  • I set a primary key and links before building the windows.
Self-assessment 1-5: do I think about the analysis before the windows?Self-assessment 1-5: can I distinguish file, item and link?

Frequently asked questions

Why should you take care of the analysis before starting the windows?

Because in WinDev everything follows from the analysis: RAD generates windows and reports from it, fields bind to items, and queries and reports rely on it. A shaky model contaminates the whole application, and fixing the structure afterwards requires a domino effect plus a risky data migration. It is the most profitable investment of the project, as Yacine does.

Why does WinDev talk about “files” and “items” rather than tables and columns?

It is a historical vocabulary choice by PC SOFT: the concepts are those of classic relational databases (file = table, item = column, record = row, link = relationship, analysis = schema). You need to know this correspondence so you do not get lost — and above all not confuse the “file” of the analysis (= a data table) with a file on disk.

Check your understanding

What is called the analysis in WinDev?

Additional resources (optional, to go further)

Level 0 examFresh, harder questions to test what you've learned