AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Administrar bases de datos / HFSQL
  • Overview
  • How to manage the NULL value in an item?
  • Managing the NULL value
  • Limitations
  • How to use the NULL value in my applications?
  • How to save a NULL value in an item?
  • Customizing the display of the items whose value is NULL
  • Query: Selection condition
  • Example
  • Limitations
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
Overview
WINDEV, WEBDEV and WINDEV Mobile allow you to manage the NULL value in fields in HFSQL data files and for all other types of access (Native, OLE DB, etc.).
Therefore, when calculations are performed in your data files, the records containing a Null item will be ignored. For example, if a query calculates the average grade of students for the quarter, only the grades of the attending students will be taken into account. If a student is absent, their grade will be a Null value.
How to manage the NULL value in an item?

Managing the NULL value

To manage the null value in your data files, you can use:
  • In the data model editor:
    • the "Aceptar valores NULL" option in the data file description ("Details" tab). This option allows you to specify if the data file supports NULL values. In this case, you will have the ability to manage the NULL value for the different items of the data file.
    • the "Permitir valores NULL en los índices (compatible solo con la versión 28 y posteriores)" option in the data file description ("Details" tab). This option indicates that the key item can contain NULL values. Records whose indIices contain NULL values will be searchable.
      CAUTION: Once this feature is enabled, the generated index file is only compatible with versions 28 and later.
      Only applications compiled in version 28 and later will be able to access these data files.
      An error occurs if an application developed in version 27 or earlier attempts to access a file and this option is enabled: "Error, the file version is too recent".
    • a "Default to NULL" option available for each item of your files ("General" tab of the item description). This option allows you to define the null value as default value for the item.
    • a "NULL allowed" option for each item of your files ("General" tab of the item description). This option is used to allow (or not) the use of the NULL value for this item. By default, if NULL is supported by the data file, the "NULL Allowed" option is checked for all the items of the data file.
  • In programming, several properties:
    NullEl Null Property se utiliza para:
    • Asignar NULL al elemento para la actual Record.
    • Averiguar si el artículo está asociado con el valor NULL para el Record actual.
    • Define el valor de Default de un artículo cuando éste se describe mediante programación.
    NullableIndexLa propiedad NullIableIndex determina si un campo clave acepta valores "Null".
    NullAllowedEl NullAllowed Property se utiliza para gestionar el valor NULL en los elementos de los archivos de datos HFSQL.
    NullSupportedEl NullSupported Property se usa para administrar el valor NULL en los archivos de datos HFSQL.

Limitations

The NULL value cannot be used:
  • on the array items.
  • on the composite keys.
How to use the NULL value in my applications?

How to save a NULL value in an item?

  1. Check the "NULL supported" box when the data file is described in the data model editor ("Description of data file" in the context menu, "Info" tab).
    By default, "NULL Allowed" is checked for all file items.
  2. Generate the analysis.
  3. Check "NULL if empty" for the edit control linked to the item. If no value was entered by the user in this control, the NULL value will be automatically assigned to the item when using:
Remarks:
  • The "NULL if empty" option for the edit controls can also be used to manage the optional parameters of a query with parameters. For more details, see Using a query with parameters.
  • If the default value of the item is NULL (box checked in the editor), HReset resets the Null property to True.
  • By default, the "Permitir valores NULL en los índices (compatible solo con la versión 28 y posteriores)" option is not checked. This means that the data file is compatible with older versions. NULL indexes are then considered as empty strings ("") in string items, or as the value 0 in numeric items.
    If the "Nueva pestaña" option is checked, the key item can contain NULL values. Records whose indIices contain NULL values will be searchable.

Customizing the display of the items whose value is NULL

By default, if an edit control is linked to an item whose value is NULL, the value displayed in the control is "". To customize this display mode, use ControlError associated with the ceNull constant.

Query: Selection condition

In the query editor, you have the ability to take into account or to ignore the records that have a null item. To do so, create a selection condition and choose "Is null" or "Is not null".
In a selection query that performs a calculation, all the records that have a null value (for the calculation item) will be ignored.

Example

The following example is a query used to calculate the average grade of students for the 2003 French class. If one of the grades corresponds to the NULL value, this grade is ignored.
SELECT Notes.Cours AS Cours,
Notes.DateNote AS DateNote,
LEFT(Notes.DateNote,4) AS Année,
AVG(Notes.Note) AS la_moyenne_Note
FROM Notes
WHERE Notes.Cours = 'Français'
AND Notes.Note IS NOT NULL
AND LEFT(Notes.DateNote,4) = '2003'
GROUP BY Notes.Cours, Notes.DateNote, LEFT(Notes.DateNote,4)
Limitations
  • When managing the integrity, the NULL value is ignored.
  • A linked record on 0 or empty string ("") is equivalent to a linked record on NULL.
  • For backward compatibility, the transfer of Null by assignment is not allowed.
    • Don't:
      Fic1.Rub1 = Fic2.Rub2
    • Do:
      Fic1.Rub1..Null = Fic2.Rub2..Null
Novedad versión 2024
Nullable types: If "Permitir tipos que admiten valores NULL" is checked in the project description, you can use the following syntax:
Fic1.Rub1 = Fic2.Rub2
For more details, see Support NULL values: Allow nullable types.
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 12/04/2024

Señalar un error o enviar una sugerencia | Ayuda local