Bug 68364 - Fields: Conditional text error
Summary: Fields: Conditional text error
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Andreas Heinisch
URL:
Whiteboard: BSA target:24.8.0 target:24.2.0.0.beta2
Keywords:
: 108112 120758 (view as bug list)
Depends on:
Blocks: Fields
  Show dependency treegraph
 
Reported: 2013-08-21 04:29 UTC by Roberto Guimarães
Modified: 2024-01-09 13:08 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
A LibreOffice Writer file where the error can be see. (90.03 KB, application/vnd.oasis.opendocument.text)
2013-08-21 04:29 UTC, Roberto Guimarães
Details
A sample mail merge testcase (20.29 KB, application/x-zip-compressed)
2023-12-18 09:46 UTC, Mike Kaganski
Details
Conditional Text Field Value (21.44 KB, image/png)
2023-12-18 12:38 UTC, Andreas Heinisch
Details
Updated mail merge ODT (17.66 KB, application/vnd.oasis.opendocument.text)
2023-12-18 12:44 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roberto Guimarães 2013-08-21 04:29:39 UTC
Created attachment 84366 [details]
A LibreOffice Writer file where the error can be see.

Problem description: 

The problem occurs in LibreOffice Writer, at “Conditional Text”. Large numbers, in Portuguese, are separated by points, not comas. When a number with two points, like 9.999.999 is used as result of a condition, no result is showed.

Steps to reproduce:

NOTE: the signs < and > are used only as delimiters.

1. Define a text variable as follow <XYZ>.
2. Initialize it with <S>.
2. Make three tests using “Conditional Text”, following these cases:

CASE 1:
     if <XYZ EQ "S">
     then <1 622.>
     else <123456>
     The result (OK) will be <1 622.>

CASE 2:
     if <XYZ EQ "S">
     then <1.622_>
     else <123456>
     The result (OK) will be <1.622_>

CASE 3:
     if <XYZ EQ "S">
     then: <1.622.> <-- Attention to two points.
     else <123456>
     The result (NOT OK) will be nothing.

Current behavior: In CASE 3 nothing is showed.

Expected behavior: The result should be <1.622.>
Operating System: Windows 8
Version: 4.0.4.2 release
Comment 1 Thomas van der Meulen [retired] 2013-08-22 06:30:43 UTC Comment hidden (obsolete)
Comment 2 Thomas van der Meulen [retired] 2013-08-22 06:49:48 UTC
whoops some thing went wrong, I CAN reproduce this bug running Version: 4.1.1.2
Build ID: 7e4286b58adc75a14f6d83f53a03b6c11fa2903 on Mac osx 10.8.4.
Comment 3 QA Administrators 2015-04-01 14:40:48 UTC Comment hidden (obsolete)
Comment 4 Buovjaga 2015-04-22 14:10:34 UTC
Confirmed with attachment 84366 [details].
Did not try to repro, as instructions too sparse.

Win 7 Pro 64-bit Version: 5.0.0.0.alpha0+ (x64)
Build ID: 211c12b9c64facd1c12f637a5229bd6a6feb032a
TinderBox: Win-x86_64@42, Branch:master, Time: 2015-04-18_01:51:17
Locale: fi_FI
Comment 5 Harald Koester 2015-09-22 13:03:56 UTC
Some more information:

(1) The bug occurs if there is more than one dot in the conditional text. That means, that also conditional texts with letters are not displayed. E.g. "abc.def." is not displayed. 
(2) Also a conditional text with more than one dot in the 'Else' case is not displayed.
(3) The bug does not occure if the first character of the conditional text is a dot. E.g. ".abc.def." is displayed.
(3) 2 dots directly one after another are counted as one dot. That means "abc..def" is displayed but "abc..def." is not displayed.

Win7 32 bit, Libo: 5.0.1.2.
Comment 6 QA Administrators 2016-11-08 10:27:55 UTC Comment hidden (obsolete)
Comment 7 Harald Koester 2017-02-10 12:51:42 UTC
Bug still exists in version 5.3.0.
Bug already exists in version 3.3.0. Hence inherited from OOO.
Comment 8 QA Administrators 2018-02-11 03:33:03 UTC Comment hidden (obsolete)
Comment 9 Harald Koester 2018-02-19 13:24:32 UTC
Bug checked with version 6.0.1 (64 bit, Win 10). Bug still exists according original description.
Comment 10 QA Administrators 2021-01-22 04:07:28 UTC Comment hidden (obsolete)
Comment 11 sdc.blanco 2023-12-17 19:34:17 UTC
Possibly bug 108112 is a DUP.
Comment 12 Andreas Heinisch 2023-12-18 07:34:32 UTC
*** Bug 120758 has been marked as a duplicate of this bug. ***
Comment 13 Andreas Heinisch 2023-12-18 07:43:12 UTC
*** Bug 108112 has been marked as a duplicate of this bug. ***
Comment 14 Andreas Heinisch 2023-12-18 09:11:36 UTC
The problem lies in [1] where the fields are being evaluated. It will be assumed that everything containing two dots will be a database field. However, I couldn't insert a condition where its true/false value comes from a database, e.g.:

test_case.Contacts.Title=="Engineer" from bug 120758 
Neither one of the conditions evaluate to the content of the database field:
test_case.Contacts.Title
Contacts.Title
Title

Is this another bug or shouldn't we evaluate the true/false conditions to database fields in [2]?

Yet another workaround is to escape the fields using double quotes "1.622.".


[1] https://opengrok.libreoffice.org/xref/core/sw/source/core/fields/docufld.cxx?r=3020dfbe#1358
[2] https://opengrok.libreoffice.org/xref/core/sw/source/core/fields/docufld.cxx?r=3020dfbe#1392
Comment 15 Mike Kaganski 2023-12-18 09:46:01 UTC
Created attachment 191479 [details]
A sample mail merge testcase

(In reply to Andreas Heinisch from comment #14)
> However, I couldn't insert a condition where its true/false value comes from
> a database

The attachment is a ZIP with two douments:
- foobar_db.ods - a "database" with two fielda and three records;
- foobar_mm.odt - a mail merge document, having a paragraph with a condition based on database field value.

It works here, using Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1
CPU threads: 24; OS: Windows 10.0 Build 22631; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

e.g., when printing the ODT, agreeing to pring a form letter, and saving the result to a single file, you see that page 2 has the paragraph with the condition correctly hidden, unlike pages 1 and 3.
Comment 16 Andreas Heinisch 2023-12-18 12:38:09 UTC
Created attachment 191484 [details]
Conditional Text Field Value

Thank you Mike for the test case where it works in the merge case. In the attachment I tried to add a conditional text field using foobar_db.Sheet1.bar as the then value. This does not work? Or am I missing something?
Comment 17 Mike Kaganski 2023-12-18 12:44:55 UTC
Created attachment 191485 [details]
Updated mail merge ODT

Works here. This is a replacement for the ODT in the ZIP attached earlier.
Comment 18 Commit Notification 2023-12-20 18:57:44 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/74f25206bc5a1a36b85683555cb27179e5da3275

tdf#68364 - Don't assume a database if only two dots are present

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Commit Notification 2023-12-21 11:03:54 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/57d32cde67239f6723dfb09d8809c989f4c3bf78

tdf#68364 - Don't assume a database if only two dots are present

It will be available in 24.2.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 tobias.fr 2024-01-09 13:08:43 UTC
Thanks, it works now for me 👍

Version: 24.2.0.1 (X86_64) / LibreOffice Community
Build ID: b4d45829793cddfe67b58a53f495528c75738d8a
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: threaded