Bug 120758 - A field remains empty if the "Then" field contains several points (Mail Merge conditional text)
Summary: A field remains empty if the "Then" field contains several points (Mail Merge...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
4.1 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Mail-Merge Fields
  Show dependency treegraph
Reported: 2018-10-21 20:52 UTC by Nawar Aldanaf
Modified: 2022-06-21 11:29 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:

test case db (3.37 KB, application/vnd.sun.xml.base)
2018-10-27 09:08 UTC, Oliver Brinzing
test case document (9.09 KB, application/vnd.oasis.opendocument.text)
2018-10-27 09:08 UTC, Oliver Brinzing

Note You need to log in before you can comment on or make changes to this bug.
Description Nawar Aldanaf 2018-10-21 20:52:24 UTC
Suppose you want to Mail Merge and to insert a new field with a condition (insert → Field → more Fields → Functions → conditional text).
In the field "Condition": [testdb.Sheet1.Title]=="Engineer"
In the field "Then": Prof. Dr. Eng.
After printing the document, you should see the text Prof. Dr. Eng. if the condition is true. But it remains empty, because it contains several points. I tested it without points and it worked!

Steps to Reproduce:
1.insert → Field → more Fields → Functions → conditional text
2.In the field "Condition": [testdb.Sheet1.Title]=="Engineer"
3.In the field "Then": Prof. Dr. Eng.
4.Print the document and click yes when you see the dialog (Your document contains address database fields. Do you want to print a form letter?).
5.Open the exported file and see the results!

Actual Results:
The field remains empty. 
The text would be printed only if the field "Then" doesn't contain this points.

Expected Results:
The inserted field should contain Prof. Dr. Eng.

Reproducible: Always

User Profile Reset: No

Additional Info:
Build ID: 1:5.2.7-1+deb9u4
CPU Threads: 8; OS Version: Linux 4.9; UI Render: default; VCL: gtk2; 
Locale: en-US (en_US.utf8); Calc: group
Comment 1 Oliver Brinzing 2018-10-27 09:07:54 UTC
reproducible with:

Version: (x64)
Build-ID: a9670562c26181ec3afbe381c9ff499ae88c98b7
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; 
Gebietsschema: de-DE (de_DE); Calc:
Comment 2 Oliver Brinzing 2018-10-27 09:08:22 UTC
Created attachment 146054 [details]
test case db
Comment 3 Oliver Brinzing 2018-10-27 09:08:47 UTC
Created attachment 146055 [details]
test case document
Comment 4 Xisco Faulí 2018-10-30 11:22:18 UTC Comment hidden (obsolete)
Comment 5 Xisco Faulí 2018-10-30 11:24:03 UTC
Also reproduced in Version (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 6 Xisco Faulí 2018-10-30 11:28:14 UTC
(In reply to Xisco Faulí from comment #4)
> it works if no dots are used...

So it happens if more than one dot is used. Same behaviour with the else statement
Comment 7 Xisco Faulí 2018-10-30 12:26:34 UTC
I guess LibreOffice assumes if there's more than a dot the string points to a table in a database like we would do with test_case.Contacts.Title=="Engineer".
Obviously, as Prof. Dr. Eng. doesn't exist, it prints an empty string. My 2 cents...

@Jan-Marek, I thought you could be interested in this issue...
Comment 8 Nawar Aldanaf 2018-10-30 14:11:03 UTC Comment hidden (obsolete)
Comment 9 Oliver Brinzing 2018-10-30 17:36:20 UTC Comment hidden (obsolete)
Comment 10 Nawar Aldanaf 2018-10-30 18:10:46 UTC Comment hidden (obsolete)
Comment 11 Jan-Marek Glogowski 2018-10-30 20:21:24 UTC
My guess is other people use it in documents to refer to a DB entry.
I don't know if spaces would be allowed but even if not this probably used to be an error, so making that a valid different case instead won't help much.

What happens if you escape the dots as \.? No idea if this is supported in these fields, but it would probably be a way to implement it and won't break documents. Or is there some other common escaping variant used in LO?
Comment 12 Jan-Marek Glogowski 2018-10-30 20:23:09 UTC
Or even ODF hase some specs, how this field should behave and be encoded or escaped.
Comment 13 Xisco Faulí 2018-10-30 20:25:12 UTC
Nothing happens if dot is scaped ( \. ). OTOH, spaces are accepted
Comment 14 QA Administrators 2021-01-16 04:16:24 UTC Comment hidden (obsolete)
Comment 15 Mike Kaganski 2022-05-05 06:33:29 UTC
It works fine if "Prof. Dr. Eng." is used *with double quotes*

-> possibly NOTABUG

Also there *might* be a possible enhancement to detect more "invalid" names, like having spaces - but generally that would be just a bit more convenience, but not a game changer, since there would still be plenty of cases where quotes would be required to disambiguate (e.g., where spaces are not used).