Bug 129966 - Inserting a variable with time format gives "Expression is faulty" - locale problem
Summary: Inserting a variable with time format gives "Expression is faulty" - locale p...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.3.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: User-Locale Fields-Variable
  Show dependency treegraph
 
Reported: 2020-01-13 01:57 UTC by sdc.blanco
Modified: 2020-05-10 20:47 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sdc.blanco 2020-01-13 01:57:27 UTC
In LO 6.3.4.2

1. Ctrl-F2 – Variable tab.
2.  Select Set Variable
3.  Under Format, click on Additional Formats
4.  In ‟Format Number” dialog, select category ‟Time” and Format  ‟13:37”, click OK
5.  In ‟Fields” dialog, give 13:30 as value.
6.  ‟Insert”

Actual result:  ** Expression is faulty **
Expected result:  13:30

Additional information:

1.  Works properly in 6.5.0.0.alpha
2.  6.3.4.2 can read/display properly a document (prepared in 6.5.0.0.alpha) with this procedure.
3.  Ctrl-F9 shows proper value was entered. (Do not worry about the 0,5625 – see bug #30873)
4.  Edit Field shows proper formatting was recorded.
5.  Maybe someone can test with a version of 6.4.0.x
Comment 1 sdc.blanco 2020-01-13 09:27:45 UTC
Additional information.

I believe problem is with how "locale" interacts with variables.
Can now reproduce problem in both 6.3.4.2 and 6.5.0.0  (but with different effects in the two versions.)

Revised procedure.

In LO 6.3.4.2

0.  Set locale setting to Danish  (Alt-F12-Language-Language Settings -locale)
         (or any other locale that uses , before decimal numbers)
0.1 Open a document where the language of the document is set to English.
         (or any other language that uses . before decimal numbers)
1.  Ctrl-F2 – Variable tab.
2.  Select Set Variable
3.  Under Format, click on Additional Formats
4.  In ‟Format Number” dialog, select category ‟Time” and Format  ‟13:37”, click OK
5.  In ‟Fields” dialog, give 13:30 as value.
6.  ‟Insert”

Actual result:  ** Expression is faulty **

7.  Double-click on inserted variable (or edit in Variable tab of Fields dialog).
8.  Note that value is:  0,5625  (if you used 13:30)
9.  Change "," to "."

All is right with the world again.  Apparently, the Danish locale was used to convert 13:30 into 0,5625 -- which was inserted into the English document, which could not interpret the number, hence "Expression is faulty"

In 6.5.0.0.alpha --

Steps 0-6 as above.
7.  Show Variable, and insert the variable you just created.

Actual result:  Inserted variable only has shading (if turned on with Ctrl-F8)
                Show Variable:  00:00

8.  As before, edit the variable field. Change , to .

Good to go...
Comment 2 Buovjaga 2020-05-09 13:23:59 UTC
(In reply to sdc.blanco from comment #1)
> In 6.5.0.0.alpha --
> 
> Steps 0-6 as above.
> 7.  Show Variable, and insert the variable you just created.
> 
> Actual result:  Inserted variable only has shading (if turned on with
> Ctrl-F8)
>                 Show Variable:  00:00
> 
> 8.  As before, edit the variable field. Change , to .

Could not reproduce. Inserted "Show Variable" also has shading. If I format "Show Variable" in the same way as "Set Variable" before inserting, I get the correct 13:30 inserted. Maybe test with a newer build.

Arch Linux 64-bit
Version: 7.0.0.0.alpha1+
Build ID: c73418d8d1258ea0a8c77c07672fd182e2b28b26
CPU threads: 8; OS: Linux 5.6; UI render: default; VCL: kf5; 
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 9 May 2020
Comment 3 sdc.blanco 2020-05-10 20:47:28 UTC
(In reply to Buovjaga from comment #2)
> Maybe test with a newer build.
The problem is gone.  Both 0,5625 and 0.5625 are shown as 13:30
Not dependent on locale as before.

Version: 7.0.0.0.alpha0+ (x64)
Build ID: 10e20a77ce302a0475a661ad1886f2ca83c55f3f
CPU threads: 8; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win;
Locale: da-DK (en_DK); UI-Language: en-US
Calc: threaded 
Built on 14 March 2020