PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Overview
  • Unique key
  • Key with duplicates
  • Primary key
  • Simple key or composite key
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
Keys are specific items in your analysis. These items are used to:
  • easily identify the records. For example, in a Product file, the reference identifies the product. This reference is unique for each product.
  • organize the data stored in a data file. For example, a key defined on the Name item of the Customer data file will allow you to quickly sort the records of the data file by name.
Several types of keys can be defined in a data file
Unique key
A unique key is a key for which there can only be one value in the data file.
For example, in a "PRODUCT" file, each product is identified by a unique reference. The "REFERENCE" item must be a unique key.
Remarks:
  • If no item can be defined as a unique key, use an item of type "Automatic ID". For each record, the value of this item will be a unique integer.
  • Unique key with NULL as default value: When used in the index of String items, the NULL value is considered as an empty string (""), and as 0 when used in Numeric items. Therefore, unique keys cannot contain NULL values.
Key with duplicates
A key with duplicates is a key for which there can be several identical values in the data file.
For example, in the "CUSTOMER" data file, a key with duplicates can be defined on the "NAME" item. The content of this key can be the same in different records (e.g. for homonyms). This key enables you to perform a search by customer name.
New in version 28
Primary key
A primary key is a unique key that cannot be Null. Only one primary key can be defined for a data file.
For example, in the "PRODUCT" data file, you can define a primary key on the "REFERENCE" item. Each product is identified by a unique, non-null reference.
Simple key or composite key
A simple key is a key defined on an item.
A composite key is used to define a key on several items of the same data file. This key will allow access to the records of the data file based on the combined value of two items.
For example, to simplify the order search, you can define a composite key containing the "Customer Number" and "Order Date" items.
Remark: A composite key can be:
  • A unique key,
  • A key with duplicates,
  • New in version 28
    A primary key. In this case, none of the components of the key should support the "Null" value.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment