PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
New WEBDEV 24 feature!
  • Overview
  • Creating an LDM (Logical Data Model)
  • Creating an analysis (or LDM)
  • Adding a data file into an analysis
  • Creating an item
  • Creating a link
  • Characteristics of links defined in an analysis
  • Owner data file and member data file
  • The cardinalities
  • The advanced cardinalities
  • The referential integrity
  • The different types of links
  • Operations that can be performed on an analysis
  • Generating the analysis (LDM)
  • Managing the analysis versions
  • Restoring an analysis
  • Canceling the last generation
  • Resetting the version number to 1
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
2. The analysis in practice
Previous pageTable of contentsNext page
Overview
When a project is using data files, this project must be associated with an analysis. An analysis allows you to describe the structures of data (data files, items, etc.) used in your project.
Two methods can be used to describe an analysis:
  • 1st method: Creating the analysis directly (which means a Logical Data Model (LDM)).
  • 2nd method: Creating the Conceptual Data Model (CDM), then automatically creating the analysis from the CDM. See the online help for more details.
This chapter presents the first method.
Creating an LDM (Logical Data Model)
In WEBDEV, the terms "LDM" and "Analysis" are interchangeably used to define the structure of the database associated with a project.

Creating an analysis (or LDM)

To create a LDM:
  1. Click among the quick access buttons. The window for creating a new element is displayed: click "Data" then "Analysis". The wizard for analysis creation starts.
  2. Specify:
    • the analysis name and directory. The analysis corresponds to a ".WDA" file. By default, this file will be created in the directory of the project analysis (.ANA directory). This directory must be accessible in read/write.
    • the analysis caption that briefly describes the analysis subject.
    • whether the analysis must be associated with the current project.
    • the type of database used by the project.
  3. The creation of first data file is automatically proposed.
  4. Create all elements (data files, items and links) of your analysis.

Adding a data file into an analysis

The analysis is used to define the structure of data files used by the project. A data file found in the analysis can be:
  • A new data file.
  • A preset data file, supplied with WEBDEV.
  • A data file imported from an existing database (using a specific format for example).
The following paragraphs explain how to create a data file.
To create a new data file:
  1. On the "Analysis" pane, in the "Creation" group, click "New file". The wizard for creating a data file starts.
  2. Select "Create a new description of data file".
  3. Specify:
    • the name of data file. This name is the logical name of the data file. It will be used to handle the data file.
    • the caption of data file that briefly describes the file subject.
    • the representation of a record in the data file. This representation improves the legibility of questions asked when describing links. This option must be preceded by an indefinite article (A or AN).
    • whether the data file includes an "Automatic identifier" item. The value of this item is unique for each record and it is automatically calculated by WEBDEV.
    • the type of database associated with the data file. Depending on the selected type, this data file will be handled by the HFSQL engine, by an OLE DB driver or by one of the native accesses (also called native connectors) of WEBDEV (SQL Server, Oracle, ...).
  4. The created data file becomes the current data file. The description window of file items is automatically opened. It allows you to describe the file items.
To import a preset description of a data file:
  1. On the "Analysis" pane, in the "Creation" group, click "New file". The wizard for creating a data file starts.
  2. Select the option "Select a description among the preset data files".
  3. Choose the preset data file to create (you have the ability to select several ones). This data file will be imported into the current analysis. This data file can be modified later.
  4. Select the items to store. These items can be modified later.
  5. Specify whether the links must be automatically sought. If this option is checked, the items with the same name will be linked.
  6. The imported data file is automatically inserted into the current analysis.
Note: To modify a data file or the items found in a data file:
  1. Select the data file.
  2. Select "Description of data files" or "Description of items" from the popup menu.
To import the existing description of a data file, two solutions are available:
Solution 1: From the data model editor
  1. On the "Analysis" pane, in the "Creation" group, click "New file". The wizard for creating a data file starts.
  2. Select "Use the data files from an existing database" and select the type of database.
  3. Specify the source database containing the descriptions to import and the type of this database. Depending on the selected type, specify the requested information.
  4. Select the tables or the data files whose description must be imported and validate.
  5. The imported data file is automatically inserted into the current analysis.
Solution 2: From the Windows explorer
Drop the file description from the Windows explorer to the data model editor. For example:
Here : an Oracle database on the server. All you have to do is drag the database name...
... to transfer its description into the data model editor.

Creating an item

To create an item:
  1. Double-click the data file where the item will be created. The description window of file items is opened.
  2. Click the first empty row in the table of items.
  3. Specify the name, the caption and the type of item in the table.
  4. In the right section of the screen, specify the details about the new item (type, size, default value, search direction, ...).
  5. In the bottom section of the screen, specify the details about the shared information.
  6. Validate the item description.
Note: You can create an item using the metatypes offered by WEBDEV. To do so, click the "+M" button on the right of the table. The list of available meta-types is displayed.

Creating a link

Different types of links can be created between data files. See "Characteristics of links defined in an analysis" for more details.
To create a link:
  1. On the "Analysis" pane, in the "Creation" group, click "New link". The mouse cursor turns into a pen.
  2. Select the two data files to link. The window for link description is automatically opened.
  3. To define the cardinalities:
    • select the cardinalities among the proposed ones (0, 1; 1, 1; 0, N; 1, N).
    • answer the questions asked. The cardinalities will be automatically updated.
  4. To describe the advanced cardinalities, check "Display the advanced cardinalities" and answer the questions asked.
  5. Type the link caption by briefly describing the link purpose.
  6. Specify the keys to link.
  7. Define the integrity rules. These rules are used to ensure the data integrity when one of the relation keys is modified or deleted.
  8. Validate. The link is automatically created.
Characteristics of links defined in an analysis

Owner data file and member data file

When a link is defined between two data files, there is an owner data file and a member data file:
  • the owner data file is the owner of the key.
  • the member data file is a member of the analysis data files containing a copy of the key.
To manage the link between two data files, the key of owner data file is copied into the member data file.
For example, the key of the Supplier data file is copied into each record of the Product data file. Several records of the Product data file can have the same key of the Supplier data file:
  • Supplier is the owner data file,
  • Product is the member data file.
This type of link is represented as follows:

The cardinalities

The cardinalities are used to count the links between the data files.
The cardinality is defined according to the answers to the two following questions:
  1. For each file record, to how many records of the other file minimum is this record linked?
    The answer provides the first part of cardinality (minimum cardinality):
    • if the answer is "none", the cardinality is 0,X.
    • if the answer is "a single one", the cardinality is 1,X.
  2. For each file record, what is the maximum number of records in the other data file to which this record is linked to?
The answer provides the second part of cardinality (maximum cardinality):
  • if the answer is "a single one", the cardinality is X,1.
  • if the answer is "several", the cardinality is X, N.
The answer to these two questions defines the cardinality that can be: 0,1 ; 0,N ; 1,1 ; 1,N
The description of cardinalities is fundamental: it is the basis for respecting the referential integrity of database.
To be clearer, these two questions can be broken down into four questions. For example, to describe a link between the Customer and the Orders data files:
  • each "customer" has at least one "order": Yes/No?
  • each "customer" can have several "orders": Yes/No?
  • each "order" has at least one "customer": Yes/No?
  • each "order" can have several "customers": Yes/No?
Example of cardinalities:
This example presents two different cardinalities:
  • Cardinality 0,1: A person can be a member of a single sport club. This person does not have to belong to a sport club.
  • 0,N cardinality: A club can have no member or several members.

The advanced cardinalities

The cardinalities can be defined more precisely. We talk of advanced cardinalities.
These cardinalities are used to exactly specify the minimum cardinality and the maximum cardinality.
To define the advanced cardinalities, check "Display the advanced cardinalities" in the link description.
Example of advanced cardinalities:
This example presents two different cardinalities:
  • Cardinality 0,1: A person can be a member of a single sport club. This person does not have to belong to a sport club.
  • Cardinality 0,10: A club can have no member or up to 10 members.

The referential integrity

The referential integrity of a database corresponds to the respect of constraints implied by the links between the data files.
The referential integrity consists in checking that:
  • if a record is deleted from the owner file, the corresponding records are also deleted from the member files,
  • if a record is added into a member file, a corresponding record exists in the owner file,
  • if a record is modified in the owner file, the unique key is not modified, ...
The check of referential integrity depends on the nature of the link between data files.
See the online help for more details.

The different types of links

Several types of links can exist between the data files:
  • parallel
  • optional
  • complement
  • shared
  • complex
Parallel link
In a parallel link, each record in a data file (Product) is linked to a record in another data file (Info), and conversely.
To manage a parallel link, the identifier of the Product data file is copied into the Info data file. This identifier is also a unique key in the Info data file.
The owner data file is Product and the member data file is Info.
Note: This type of link is rare because the two data files can be grouped into a single file.
The parallelism of records in the data file is respected if the following operations are run simultaneously on the two data files:
  • creating a record
  • deleting a record
  • reindexing with compression
Optional link
For an optional link:
  • Each record of a data file (Category) is associated with no record or with a single record in another data file (Group).
  • Each record of the other data file (Group) is associated with no record or with a single record in the first data file (Category).
An optional link is performed by copying the identifier of each data file into the other data file.
Complement link
For a complement link:
  • Each record found in a data file (Product) has no associated record or a single associated record in another data file (Details).
  • Each record of the other data file (Details) necessarily has an associated record in the first data file (Product).
The complement links are quite common. They are used when a record can have additional optional information.
To manage a complement link, the key of the Product data file is copied into the Detail data file. To ensure the maximum cardinality of 1, it remains a unique key. Since this key is unique, it is not possible to insert more than one record in the Detail data file for a record in the Product data file.
The owner data file is Product, the member data file is Details.
Shared link
For a shared link, the same record in a data file (Supplier) can be shared by several records in another data file (Product).
To manage a shared link, the key of the Supplier data file is copied into the Product data file. It becomes a multiple key to increase the speed of integrity check.
The owner data file is Supplier, the member data file is Product.
Depending on the cardinality, we can distinguish between four types of shared links:
  • Shared link with a 0,n - 0,1 cardinality
  • Shared link with a 0,n - 1,1 cardinality
  • Shared link with a 1,n - 0,1 cardinality
  • Shared link with a 1,N - 1,1 cardinality
Shared link with a 0,n - 0,1 cardinality
With this type of link:
  • an owner may have no member (a supplier does not necessarily have a product).
  • a member may have no owner (a product does not necessarily have a supplier).
Shared link with a 0,n - 1,1 cardinality
With this type of link:
  • an owner may have no member (a supplier may have no product).
  • each member has a single owner (each product has a single supplier).
Note: This type of link is quite common. WEBDEV allows you to automatically create the pages used to manage the data files linked by a 0,N - 1,1 link.
Shared link with a 1,n - 0,1 cardinality
With this type of link:
  • each owner has at least one member (a supplier has at least one product).
  • a member may have no owner (a product may have no supplier).
Shared link with a 1,N - 1,1 cardinality
With this type of link:
  • each owner has at least one member (each supplier has at least one product).
  • each member has a single owner (each product has a single supplier).
Complex link
For a "complex" link, you must manage a link file, called relation file.
The relation file will be automatically created. It will contain a unique key that includes the two keys of linked data files.
The relation file can also contain information specific to the link.
A complex link includes two shared links.
Example of complex link
An order ("Orders" data file) can contain one or more products. A product (Product data file) can be used in several orders.
In this case, a link file is required (OrderLine data file).
The OrderLine data file contains:
  • a unique key containing the keys of the Product and Orders data files.
  • the number of products ordered.
The links between the data files are as follows:
Operations that can be performed on an analysis
WEBDEV allows you to perform the following operations on an analysis:
  • Duplicating/Copying an LDM: Duplicating an LDM allows you to have two identical LDMs with different names.
  • Delete an LDM.
  • Rename an LDM.
  • Associate an LDM with a project.
  • Enlarge or reduce the display of LDM in the editor.
  • Move the display of LDM in the editor.
WEBDEV allows you to perform the following operations on a data file found in the data model editor:
  • Duplicate/Copy a data file.
  • Delete a data file.
  • Rename a data file.
WEBDEV allows you to perform the following operations on an item of a data file found in the data model editor:
  • Duplicate/Copy an item.
  • Delete an item.
  • Rename an item.
See the online help for more details.
Generating the analysis (LDM)
The analysis generation is performed before the programming step and after the description of data files. This generation is used to:
  • validate the modifications performed on the analysis (LDM).
  • create the modules required for programming.
  • automatically update the data files if necessary.
As long as the analysis (the LDM) is not generated, the analysis description (the data files) cannot be used in the project.
To start generating the analysis, on the "Analysis" pane, in the "Analysis" group, click "Generation".
The generation is performed in three steps:
  • verification of modifications and generation of data files of the analysis description.
  • automatic modification of accessible data files (files found in the "EXE" directory of project).
  • Synchronizing the project.
Managing the analysis versions
WEBDEV allows you to manage the different analysis versions:
  1. On the "Analysis" pane, in the "Analysis" group, expand "Generation" and select "Manage the versions".
  2. In the wizard, specify whether you want to work on the current analysis or on a specific analysis.
Note: when an analysis is damaged, you have the ability to select the damaged analysis to restore one of the earlier versions for example.
All the analysis versions are viewed in a graph. The yellow rectangle indicates the version number of analysis; the caption on the right indicates the generation date.
The "small rectangles" displayed between two versions indicate:
  • one rectangle: few modifications have been made between the two versions.
  • several rectangles: several modifications have been made between the two versions.
To see the details of modifications performed between two versions: Double-click the line containing the "small rectangles" or click on [Modifications].
The options available in the version manager are:
  • Restoring an analysis.
  • Canceling the last generation.
  • Resetting the version number to 1.

Restoring an analysis

To restore an analysis from the version manager:
  1. Select the version to restore.
  2. You can:
    • restore the version into the specified directory. An independent analysis corresponding to the selected version is created. This option is selected by default.
    • overwrite the current analysis.
  3. Validate. The restore operation is performed.
Caution: The data files corresponding to an analysis whose version number is greater than the restored version cannot be opened anymore. In this case, you must also restore the physical files corresponding to the restored analysis version, or delete the existing files in order to re-create them.

Canceling the last generation

Canceling the last generation of analysis is used to restore the analysis to its status before the last generation. The modifications performed since then are not applied.

Resetting the version number to 1

The generation number of analysis can be reset to "1": on the "Analysis" pane, in the "Analysis" group, expand "Generation" and select "Reset the analysis version to 1".
In this case, the version number of analysis is reset to one. No specific action is performed on the data files.
Previous pageTable of contentsNext page
Minimum required version
  • Version 24
Comments
Click [Add] to post a comment