Bug 121652 - Option buttons in forms do not show current value if it is boolean
Summary: Option buttons in forms do not show current value if it is boolean
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
5.3.7.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Forms
  Show dependency treegraph
 
Reported: 2018-11-23 08:08 UTC by Evgeny Kuznetsov
Modified: 2023-11-24 17:38 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample base with a form illustrating the unexpected behaviour (12.15 KB, application/vnd.oasis.opendocument.database)
2018-11-23 08:08 UTC, Evgeny Kuznetsov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeny Kuznetsov 2018-11-23 08:08:43 UTC
Created attachment 146936 [details]
Sample base with a form illustrating the unexpected behaviour

A group of option buttons can be used in a form to select a value from a predefined set. If the underlying field is VARCHAR, INTEGER or any other type, the option buttons reflect the current data available in the record and can be used to modify that data. If, however, the underlying field is BOOLEAN, the option buttons remain empty (or reflect a default value) but still can be used to modify data.

Observed on LibreOffice 6.1.3.2 running on Debian 9 (package version 6.1.3-1~bpo9+2).

Steps to reproduce:
1. Create a table with BOOLEAN field.
2. Create a form based on that table.
3. Add a group to the form while having Element Wizards option on.
 3a. On first step of the wizard add exactly two options to the group.
 3b. On second step of the wizard select "No" (second option) for defaults.
 3c. On third step assign 0 (or FALSE) to one option, 1 (or TRUE) to the other option.
 3d. On last step of the wizard select the BOOLEAN field in the table to save your data to.
4. Populate the table with data.
5. Open the form and use [Ctrl+Alt+left] and [Ctrl+Alt+Right] (or corresponding buttons) to scroll through the record. Observe condition of the option buttons.

Expected behavour:
If data exists, option buttons show the corresponding option.

Actual behaviour:
Option buttons remain empty even if data exists.

The attached sample file has a table with BOOLEAN, VARCHAR and INTEGER fields as well as a form with corresponding controls (created using Form Wizard). Option button groups are created for each field using the procedure described on step 3 above. Table has 4 records with data. The form can be used to scroll through existing records demonstrating option buttons behaviour for the three fields: VARCHAR and INTEGER behave as expected, BOOLEAN behaviour is faulty.
Comment 1 Evgeny Kuznetsov 2018-11-23 08:19:19 UTC
Reproduced on Windows Vista 32bit using LibreOffice 5.3.7.2.
Comment 2 Robert Großkopf 2018-11-23 18:19:15 UTC
Seems this is the reason:
-----
3c. On third step assign 0 (or FALSE) to one option, 1 (or TRUE) to the other option.
-----
Isn't the same for the field. If you set it to 'true' (lower cased) and 'false' (also lower cased) it will work right.

The checkbox for boolean field works the same way. If you set the values here to 1 and 0 it won't show 'true' content.

Don't know why it isn't implemented, because it works well in queries. But the values shown by the queries in Tools > SQL will show with
SELECT * FROM "demo" where "boolean" = 1
Output: 
0,true,1,1,
2,true,0,1,

I will confirm the bug, but it will work right with the value queries return for the boolean fields.
Comment 3 Evgeny Kuznetsov 2018-11-23 19:16:51 UTC
> Isn't the same for the field. If you set it to 'true' (lower cased) and
> 'false' (also lower cased) it will work right.

That's right, it will. Which makes this bugreport more about behaviour inconsistency than anything (perhaps the description should be updated).

What I mean is:

- if TRUE/FALSE or 1/0 is incorrect representation for boolean values (in LibreOffice Base's conventions) then these radiobuttons should not set the values correctly and produce error instead or just fail silently;
- if TRUE/FALSE or 1/0 is considered correct representation of boolean values (as well as true/false) then these cases should be handled properly and the radiobuttons should work as expected.
Comment 4 QA Administrators 2019-12-04 04:21:18 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2021-12-04 04:42:42 UTC Comment hidden (obsolete)
Comment 6 Evgeny Kuznetsov 2021-12-04 05:01:49 UTC
Still an issue in 7.0.4.2.
Comment 7 Andreas Säger 2023-11-24 17:38:12 UTC
Works with OpenOffice. 
Discussion and another demo can be found at https://ask.libreoffice.org/t/best-practice-for-filling-in-option-buttons-from-table/98610/11