Bug 70346 - Section condition doesn't hide section with database fields
Summary: Section condition doesn't hide section with database fields
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.2.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: lhm-limux target:4.4.0 target:4.5.0 t...
Keywords: regression
Depends on:
Blocks: 89346
  Show dependency treegraph
 
Reported: 2013-10-10 13:33 UTC by Georg
Modified: 2017-07-03 16:06 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Mailmerge with hidden sections (13.04 KB, application/vnd.oasis.opendocument.text)
2013-10-10 13:33 UTC, Georg
Details
Datasource for Mailmerge (11.30 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-10-10 13:34 UTC, Georg
Details
PDF printed using 4.4.0.0 alpha2 from Nov 12 (19.50 KB, application/pdf)
2014-11-14 13:08 UTC, Buovjaga
Details
Original document with fixed hide conditional sections (12.93 KB, application/vnd.oasis.opendocument.text)
2014-11-14 13:54 UTC, Jan-Marek Glogowski
Details
Correct / expected result (38.14 KB, application/pdf)
2014-11-14 13:55 UTC, Jan-Marek Glogowski
Details
Test document using bibliography (8.95 KB, application/vnd.oasis.opendocument.text)
2015-03-18 18:36 UTC, pierre-yves samyn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Georg 2013-10-10 13:33:52 UTC
Created attachment 87398 [details]
Mailmerge with hidden sections

I created the attached mailmerge document with some sections. Each section should show one record. At the end, empty sections should be hidden. 

Attached you also find the data source document to create your own test.

I tried to hide the section by using the section condition field.
I made several tests by using other conditions, but it doesn't work fine.
I think that the condition does not recongize, that the record changes.

Here some example for possible conditions:

![MAV]
[MAV] == [Org-Nr.]

and many more.

I also tried to use the Master/Slave link, as it is used by labels. Using labels, you will have the same problem, becaus all labels will be printed and not be hidden.

It would be nice to fix the error code, because our customer needs a quick solution.

Regards
Georg
Comment 1 Georg 2013-10-10 13:34:46 UTC
Created attachment 87399 [details]
Datasource for Mailmerge
Comment 2 Georg 2013-10-10 13:42:39 UTC
Regarding the mailmerge labels: If you create some labels and if you place a logo on each label, all labels will be printed also if there is no data from the database on it. So the condition doesn't work here as well.

To the conditions I used: 
[MAV] == [Org-Nr.]    In some forums I found this recomendition, to compare two different fields that never would contain the same data. At the end of the records, the next, empty record, should be deliver empty (NULL) fields. So only in this case the condition becomes true. In all other cases the condition becomes false.

![MAV]   Here I tried to check if data existis (true) or not (false)
Comment 3 Joel Madero 2014-07-10 01:36:06 UTC
Not a major bug - lowering to:

Normal: Can prevent high quality/professional work
Medium: Default seems appropriate

For reference please see: 

https://wiki.documentfoundation.org/images/0/06/Prioritizing_Bugs_Flowchart.jpg

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
LibreOffice is powered by a team of volunteers, every bug is confirmed (triaged) by human beings who mostly give their time for free. We invite you to join our triaging by checking out this link:
https://wiki.documentfoundation.org/QA/BugTriage

There are also other ways to get involved including with marketing, UX, documentation, and of course developing -  http://www.libreoffice.org/get-help/mailing-lists/. 

Lastly, good bug reports help tremendously in making the process go smoother, please always provide reproducible steps (even if it seems easy) and attach any and all relevant material
Comment 4 Commit Notification 2014-09-16 08:36:47 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4851cde7b98226b0f82ae2b191c290173e9b06c6

fdo#70346 MM: add mail merge data to condition dict



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 5 Buovjaga 2014-11-14 08:13:17 UTC
Judging from comment 4 this is fixed, but I don't know how to verify as the original instructions do not have clear steps.
What fields to assign to which stuff when creating the data source?
I see the conditions can be created in Select address list - Filter, but what should I input and what should I be seeing as an expected result?
Comment 6 Jan-Marek Glogowski 2014-11-14 12:38:04 UTC
To clarify the steps:

1. Open odt
2. Goto Format -> Sections
2.1 Fix hide conditions in the sections to be !MAV
3. Run MM with attached datasource

The Datasource has 5 entries, the document has 7 sections / lines. The resulting document should just show 5 lines - the other two lines should be hidden.

Previously LO was just able to check fields used in the document, but not other fields in the DB. The patch adds values from unused columns to the evaluation dictionary, so these can be used in the condition evaluation.
Comment 7 Buovjaga 2014-11-14 13:08:07 UTC
Created attachment 109463 [details]
PDF printed using 4.4.0.0 alpha2 from Nov 12

Showing seven empty rows per page.
Is this incorrect?

Win 7 64-bit Version: 4.4.0.0.alpha2+
Build ID: b021b5983c62e266b82d9f0c5c6d8d8900553827
TinderBox: Win-x86@39, Branch:master, Time: 2014-11-12_01:10:08
Comment 8 Jan-Marek Glogowski 2014-11-14 13:54:41 UTC
Created attachment 109467 [details]
Original document with fixed hide conditional sections
Comment 9 Jan-Marek Glogowski 2014-11-14 13:55:52 UTC
Created attachment 109468 [details]
Correct / expected result
Comment 10 Buovjaga 2014-11-14 15:34:14 UTC
Well, I don't get that result. Maybe I'm not grokking the procedure, but the attachment serves as verification, so let's close this as fixed.
Thanks for the patch.
Comment 11 pierre-yves samyn 2015-03-18 18:34:54 UTC
Hi

I reproduce on Windows 7/64 & Version: 4.4.2.1
Build ID: 93fc8832889bf050a10ec6d0171dae213adc9b55
Locale: fr_FR

I do not agree with comment 6

> Previously LO was just able to check fields used in the document, but not 
> other fields in the DB. 

This *worked* in previous versions and it was possible to test database fields for at least OOo3.2.

From the comments, it seems that the correction was never verified.

So I reopen and set REGRESSION.

I do not know from which version the bug was introduced. To facilitate testing, I attach a test document using the bibliography installed by default.

The document contains three sections. Conditions hide:
[Bibliography.biblio.Custom1]!="Deutsch"
[Bibliography.biblio.Custom1]!= "English"
[Bibliography.biblio.Custom1]!= "Français"


Steps to Reproduce /
1. Open the attached document
2. View> Datasources (F4)
3. Select Bibliography> Tables> biblio
4. Use the vertical scroll bar to display the column "Custom1"
5. Click the header to select a record.
6. Click "Data to Fields" in the Datasource toolbar

Expected result: depending on the content of the "Column1" only the corresponding section should appear.
Actual result: All sections are displayed

More information: hide a section depending on the value of a variable still works, but may be this bug is related to Bug 55814 ?

Regards
Pierre-Yves
Comment 12 pierre-yves samyn 2015-03-18 18:36:17 UTC
Created attachment 114170 [details]
Test document using bibliography
Comment 13 Commit Notification 2015-03-19 15:24:11 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=adb98d94ca1059b56d6b6726ca9aea96ecae8a96

tdf#70346 MM: don't restore section visibility

It will be available in 4.5.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 14 Jan-Marek Glogowski 2015-03-19 15:36:15 UTC
Hmm - ok I didn't realize this formating for conditions, so my patch is actually not needed and just a little bit of convenience for a user.

I just fixed the introduced regression.
Comment 15 Commit Notification 2015-03-19 16:33:03 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ea1caeed5cc70f41957d56af0ccb4bfdbd01cb87&h=libreoffice-4-4

tdf#70346 MM: don't restore section visibility

It will be available in 4.4.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 16 Jean-Baptiste Faure 2015-03-21 14:53:06 UTC
(In reply to pierre-yves samyn from comment #11)
[...]
> Expected result: depending on the content of the "Column1" only the
> corresponding section should appear.
> Actual result: All sections are displayed

With the last commits it works now as expected. Tested with LibreOffice 4.4.3.0.0+ and master built at home under Ubuntu 14.10 x86-64.

Closing as RESOLVED-FIXED. Thank you very much Jan-Marek.

Best regards. JBF