Frequently asked questions - Base

    From The Document Foundation Wiki
    < Faq‎ | Base

    How to create calculated fields or results depending on a function applied to other fields?

    Example: field C = addition (concatenation) of fields A & B

    This effect cannot be produced directly in a table, one of the principles in a relational database is that calculated data is not stored, since it can be calculated.

    With LibreOffice it is necessary to make use of a view or a query to produce the calculation.

    For example, the following SQL command can be included in a request to concatenate the fields "field1" and "field2"

    CONCAT( CONCAT( 'field1', ','), 'field2')

    The result (if neither of the fields are null) will be <contents of field1>,<contents of field2> (for example Smith, Fred).

    Note: The column header will, by default, be the formula used for the calculation. It is often preferable to add an alias to calculated fields.