Issue 56195

Summary: Hidden Paragraphs (and Hidden / Conditional Text) Do Not Work With Multiple Records - Only Test For Final Record On Page And Then Apply To All
Product: Writer Reporter: phillg <phill.gillespie>
Component: codeAssignee: Oliver Specht <os_ooo>
Status: CLOSED FIXED QA Contact: issues@sw <issues>
Severity: Trivial    
Priority: P3 CC: helge.kraak, issues
Version: 680m129   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 36696    
Attachments:
Description Flags
Example One, address2 incorretly being hidden for record one
none
Example One when "Show Hidden Paragraphs" is on, address2 is clearly hidden incorrectly
none
Example Two, address2 is incorrectly printed for record two even though it is null
none
Sample doc as requested
none
Result of Test 1 - empty author is shown
none
Result of Test 2 - author field is hidden despite not being empty
none
Attaching test file.
none
Attaching test file.
none
Attaching test file.
none
Camera capture of the moments after printing (doc is fine then incorrect) none

Description phillg 2005-10-18 12:02:18 UTC
Hidden paragraphs do not work with more than one record to a page (i.e. labels).

Pre-requiste:

A db connection with three records with three fields each.  Mine looks like this:

Address1   Address2   Address3
  text       text       text
  text       null       text
  text       text       text


Steps to reproduce:

Open a blank document and create a new text file.  Drag down the fields, one per
line (separated by a new paragraph) and add in a "Next Record" at the end a a
hidden paragraph ( not([Address2]) or [Address2] eq "" it doesn't matter) so the
document looks like this:

"Record One..."
Address1
[hiddenparagraph] Address2 "Print me only for record one and three"
Address3
[next record]

Copy and paste the above, delete the final "Next Record" and change the "One" to
a "Two".  Go to File and Print and perform a Form Letter.  Only ask for records
one and two to be printed.

The output should look this:

"Record One"
Address1
Address3

"Record Two"
Address1
Address3

The line starting Address2 for record one is hidden, even though it is not
empty.  It has done it correctly for record two though.

Change "One" and "Two" to "Two" and "Three" respectively then go to file and
print again but this time ask for records 2 and 3.  The output will look like this:

"Record Two"
Address1
"Print me only for record one and three"
Address3

"Record Three"
Address1
Address2 "Print me only for record one and three"
Address3

Address2 for record two is shown when it should be hidden but it is correct for
record three.

What seems to be happening is the hidden paragraph is only being tested for the
last record on the page and then the results are being applied to all instances
of it.  In the first exmaple Address2 should be hidden so all Address2s on the
page were hidden.  In the second example Address2 should be shown so for all
other Address2s it is shown.

This bug basically makes hidden paragraphs useless for labels (which is probably
the most common time to use hidden paragraphs) and any other multiple records to
a page.

Issue 36696 (hide blank lines option in labels, a la Word 97) has been fixed for
2.0.1 and this is surely a blocker for it.
Comment 1 phillg 2005-10-18 12:07:58 UTC
Created attachment 30596 [details]
Example One, address2 incorretly being hidden for record one
Comment 2 phillg 2005-10-18 12:09:40 UTC
Created attachment 30597 [details]
Example One when "Show Hidden Paragraphs" is on, address2 is clearly hidden incorrectly
Comment 3 phillg 2005-10-18 12:11:30 UTC
Created attachment 30598 [details]
Example Two, address2 is incorrectly printed for record two even though it is null
Comment 4 michael.ruess 2005-10-18 15:34:41 UTC
Reassigned to ES.
Comment 5 eric.savary 2005-10-19 14:17:02 UTC
Please add a sample document reflecting the description.
Comment 6 eric.savary 2005-10-19 14:18:11 UTC
.
Comment 7 phillg 2005-10-20 13:27:24 UTC
Adding example doc
Comment 8 phillg 2005-10-20 13:32:44 UTC
Created attachment 30663 [details]
Sample doc as requested
Comment 9 phillg 2005-10-27 10:07:52 UTC
Confirmed in final 2.0 release.
Comment 10 eric.savary 2005-10-27 10:50:13 UTC
I cannot reproduce it (m135 on Linux) using the Biblio DB, like this:

Bibliography.biblio.Identifier
Hidden.ParagraphBibliography.biblio.Author
Bibliography.biblio.Publisher

Next Record: Bibliography.biblio

Bibliography.biblio.Identifier
Hidden.ParagraphBibliography.biblio.Author
Bibliography.biblio.Publisher

where Hidden.Paragraph is: not([Author])

I deleted Author for one of the record and merged records like this
Test 1:
Rec 1 (empty Author)
Rec 2 (Author filled)

Test 1:
Rec 1 (Author filled)
Rec 2 (empty Author)

So it's the same structure as your document.

In all tests botth Hidden.Paragraph fields work fine when the Author field is empty.

Questions:
1) do you have switch "View - Hidden.Paragraphs"?
2) could you please do the same test with the bibliography database?
The structre of a database is:
Database.Table.Field

But your DB is: Members.Licensing.web2.Address2
So a too long structure. I suspect that this may lead to the described problem.
Comment 11 phillg 2005-10-27 11:38:40 UTC
1.  I don't have Show Hidden Paragraphs on, although I briefly turned it on for
the "exmaple-one-with-show-hidden-paragraphs-on.jpg" to demonstrate that the
field is correctly being filled, it's the 

DB:  The DB I was connecting to is MySQL via ODBC.  The latest drivers (v3) use
pass "database name . table name" back to OOo and are the only ones reccomended
by the guys at DBA.  The Table is "Licensing.web2" and as the hidden paragraphs
are resolving correctly for the last record on the page (or if there is only
one), this can't really be the cause.
 
Windows:  Confirmed the same problem under Windows XP and Pavel's first en-GB
build of 2.0.0.  Changing platform to All.

2.  Bibilo tests done, same incorrect results as my previous test.  Created the
docs as requested, screen shots attached and the file I used.  

Test 1 (author empty) looks ok for a second and then the hidden paragraphs kick
in an make record one's author appear even though it is blank.

Test 2 (author filled) looks good too for a second with record one's author
displayed but then it disappears a second after the merge.  Trying to get a
video of this...

Comment 12 phillg 2005-10-27 11:51:56 UTC
Created attachment 30912 [details]
Result of Test 1 - empty author is shown
Comment 13 phillg 2005-10-27 11:54:13 UTC
Created attachment 30913 [details]
Result of Test 2 - author field is hidden despite not being empty
Comment 14 jcvigor 2005-10-27 15:57:45 UTC
es,

I can reproduce a problem (same or related problem?) using the Bibliography
biblio table. I am actually using labels but after creating them I removed the
Line Feeds and replaced with Paragraph Breaks before adding the Hidden Paragraph
field then Synchronized.

My label looks like this
<Identifier>
<Address><Hidden Paragraph with condition Not(Address)>
<Author>

In the biblio table I added an address in the Address field for records 1 & 3.
View > Hidden Paragraphs and View > Field Names were turn off.

DIFFERENTING TESTING RESULTS:
If I do F4, select some records (1-4) and click the Data to Fields icon I get
the correct results. I can then click the Print icon, answer “no†to the “form
letter†question, and the labels will print correctly. This little test makes
one think thing are working correctly but the more practical test below fails.
 
If I click the Print icon, answer “yes†to the “form letter†query, select the
same records I did before (1-4) then all Address lines are hidden while
Identifier and Author lines are printed. 

I saved my test file in .odt format, opened it in OOo1.1.5, added addresses in
its biblio table for records 1 & 3 and conducted the same tests. Both worked
correctly.

Using OOo2 final on Windows 98 SE.
I will upload my test file.
Comment 15 jcvigor 2005-10-27 16:02:54 UTC
Created attachment 30922 [details]
Attaching test file.
Comment 16 jcvigor 2005-10-27 16:05:47 UTC
Created attachment 30924 [details]
Attaching test file.
Comment 17 jcvigor 2005-10-27 16:07:07 UTC
Created attachment 30925 [details]
Attaching test file.
Comment 18 jcvigor 2005-10-27 16:29:42 UTC
Sorry about the muliple uploads but I recieved no possitive feedback. All are
the same file.
Comment 19 phillg 2005-10-29 17:23:30 UTC
Just tried it on Pavel's m136 builds and it does the same incorrect behavouir
(only the last hidden paragraph is tested, the result applied to all instances
of it).  

ES: Are you still having trouble reproducing it?  So far this is four different
linux machines with four differnet builds and the official release for XP that
it is reproducable on.  Why don't you upload the document you created and said
it works for and we can test that.

I'm going to suggest that this is a blocker for 2.0.1 - as I've previously said
the new "hide blank lines" feature for labels would just create havoc if this
isn't fixed.
Comment 20 phillg 2005-10-29 17:40:24 UTC
jcvigor:

It seems you are experiencing the same bug.  When you do "data to text" and
print just that screen it works as expected.

However if you do "File > Print > Yes make a form letter" the data goes to the
fields (as you do "show hidden paragraphs" and see the filled in field) but as
the print command is initiated the hidden paragraphs then mess up the page.  I
take it the final line you had was not supposed to have an address on it (hence
it hid all addresses). 
Comment 21 phillg 2005-10-31 12:07:55 UTC
Adding video of printing procedure, shows incorrectly hidden line when you
enable  "Show Hidden Paragraphs", then disappears when you untick that option.

Adding camera capture (sorry!) of the actual seconds after printing.  You can
clearly see the top record has three lines initially (correct) and then it
suddenly disappears to only two (after the hidden paragraphs have kicked in).

"Show hidden paragraphs" was not enable for either of these captures.
Comment 22 phillg 2005-10-31 12:13:20 UTC
Created attachment 31046 [details]
Camera capture of the moments after printing (doc is fine then incorrect)
Comment 23 phillg 2005-10-31 12:16:50 UTC
Okay, I can't attach the screen capture avi as it is too big, instead you can
download it from here http://www.phillg.com/ooo2.avi
Comment 24 eric.savary 2005-10-31 13:32:23 UTC
ES->OS: Please have a look at ooo2.avi.
Sum up: when merging fields manually (for records 2 & 3), the hidden paragraph
not([Bibliography.biblio.Author]) works correctly for record 2 = Author is visible.

Buit when using the merge print wizard the author field disappears for record 2
although it is not empty.

Regression compared to OOo 1.1.5
Comment 25 phillg 2005-11-15 11:11:01 UTC
This also happens for Hidden Text and Conditional Text, altering summary to
reflect this
Comment 26 oojerre 2005-11-15 16:04:31 UTC
If I may add my bit to the confusion.  Hidden paragraphs work fine for me as
long as I'm merging and printing the entire stream of merged documents to the
printer.  However, if I merge to files, where each page merged is a .sxw file,
hidden paragraphs are ignored if there are multiple records.  The curious thing
is that if you read the document into OO, it looks correct on the screen, but
when the document is printed, as soon as you answer the "is this a mailmerge?"
question, the hidden paragraph triggers even though there is data in the field.

If only a single record is merged, then all works fine.  

My production data is too large for 2.0.0 to handle (Issue 56828), I'll try to
cull down a test case if you're interested.
Comment 27 phillg 2005-11-28 08:51:44 UTC
I've had an email from Daniel J McDonlad but I haven't had time to verify the
tests he did so I'll reproduce it here to see if anyone else can double check it:

I fought with conditional paragraphs for a day, and reproduced your
problem.  The work-around is to only use numeric data for the
conditional statements - text comparisons don't seem to function.  I
hope that will help someone diagnose the problem.

I'm running 2.0.0.cvs.20051030, which is the Mandriva 2006 released
version.
Comment 28 Mathias_Bauer 2006-01-23 13:11:53 UTC
We will not finish this task in the 2.0.2 time frame -> retargetted to 2.0.3
Comment 29 phillg 2006-04-04 14:02:27 UTC
Can somebody please confirm the status of this bug as we are approaching the
freezes for 2.0.3.  

I still can't believe that OOo2 is unable to do labels and let you hide any
blank lines.  This is a serious issue that is affecting any serious office
attempting to use OOo and what's more it's a regression from OOo1.1 and it works
when you don't use the form wizard!
Comment 30 Oliver Specht 2006-04-05 13:16:04 UTC
In the printing process fields are updated again. This is probably the reason
for the bug. 
In the merging process these update need to be skipped.
Comment 31 phillg 2006-04-10 15:46:35 UTC
I believe the final date for fixes for 2.0.3 has been pulled forward a week to
5th May.

OS:  Without wanting to pester you is there still a good chance you can fix this
by this earlier deadline?  Pretty please...
I can help with QA on the bug if that's any use.
Comment 32 Oliver Specht 2006-04-11 11:59:30 UTC
Fixed in cws os80 in
sw/inc/printdata.hxx
sw/source/ui/dbui/dbmgr.cxx
sw/source/core/view/vprint.cxx

additional change in 
sw/inc/dbmgr.hxx
Comment 33 phillg 2006-04-26 16:23:17 UTC
CWS os80 is not yet in any milestone build (checked m164) so I'm unable to do QA
(sorry, I don't have the resources to build the  suite).  As soon as it is
integrated I'll verify it, unless someone else beats me to it...
Comment 34 phillg 2006-05-02 09:02:54 UTC
Verified as fixed in os80 from milestone build 165 :-)
Comment 35 Mathias_Bauer 2007-02-05 13:58:45 UTC
closing ancient issues