Issue 51035 - In a Mailmerge Document a conditional textfield doesn't work after trying to "send as pdf via email"
Summary: In a Mailmerge Document a conditional textfield doesn't work after trying to ...
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: save-export (show other issues)
Version: 680m109
Hardware: PC All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: h.ilter
QA Contact: issues@sw
URL:
Keywords:
: 68845 (view as issue list)
Depends on:
Blocks:
 
Reported: 2005-06-21 11:31 UTC by seballa
Modified: 2013-08-07 14:42 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description seballa 2005-06-21 11:31:35 UTC
I created some Documents while playing arround with mailmerge via Macro using
com.sun.star.text.MailMerge. 

In my source document I have a conditional text field. 
The condition is : IF databasefield == "1" THEN "s" ELSE "" . This works fine so
far, the documents are created allright. When I open a document and press on
"Send File as PDF via Email", the field immediatly shows the ELSE case only. If
I reinsert the data by Hand using the DB functions it shows the right result again.
I tried to use the syntax: "[database.query.field]" aswell as "field", both work
with the mailmerge, both end with the wrong case.
Comment 1 michael.ruess 2005-06-21 11:47:46 UTC
Reassigned to HI.
Comment 2 h.ilter 2005-06-21 13:44:28 UTC
- Open fax template (faxmodern.ott) from ../share/template/<lang>/officorr
- Expand to 2 pages
-> On first page you will see "This fax consists of 2 pages..."
- Run mailmerge via pdf mail attachment
- Load the created pdf file
-> The "s" from pages is away => This fax consists of 2 page...
Note: It doesn't occur by direct pdf-export.
Comment 3 Oliver Specht 2005-08-04 11:56:00 UTC
These are two different scenarios. The initial version is about exporting a
document that still contains a (conditional) field when it is exported to PDF. 

The reason here is the calculator of the Writer that is not able to skip
processing of statemenents that cannot be evaluated because of a missing
database connection. 

The second one is about a page field that (sometimes) loses it's correct value
when it is processed in the mail merge wizard. (The 's' is gone _before_ it's
exported to pdf.)

The reason is currently unknown.
Comment 4 Oliver Specht 2005-08-05 10:03:26 UTC
Fixed in cws os64 in 
sw/inc/calc.hxx
sw/inc/dbmgr.hxx
sw/source/core/bastyp/calc.cxx
sw/source/core/doc/docfld.cxx
sw/source/ui/dbui/dbmgr.cxx
Comment 5 Oliver Specht 2005-09-01 15:12:27 UTC
Reassigned for verification

re-open issue and reassign to hi@openoffice.org
Comment 6 Oliver Specht 2005-09-01 15:12:42 UTC
reassign to hi@openoffice.org
Comment 7 Oliver Specht 2005-09-01 15:12:55 UTC
reset resolution to FIXED
Comment 8 h.ilter 2005-09-08 16:00:11 UTC
Verified with cws os64 = Still occurs.
Comment 9 h.ilter 2005-09-08 16:02:21 UTC
Back to OS
Comment 10 h.ilter 2005-09-09 14:40:16 UTC
My mistake. I've verified the second issue instead of the first one, which looks ok.
Comment 11 h.ilter 2005-09-09 14:41:18 UTC
Back to me

re-open issue and reassign to hi@openoffice.org
Comment 12 h.ilter 2005-09-09 14:41:29 UTC
reassign to hi@openoffice.org
Comment 13 h.ilter 2005-09-09 14:41:45 UTC
reset resolution to FIXED
Comment 14 h.ilter 2005-09-09 14:42:30 UTC
Set to verified.
Comment 15 helgekraak 2005-09-14 02:13:19 UTC
Hi Oliver,

today  I was also facing the problem, that only the ELSE-Condition of
Conditional Text Fields is being printed in a Mail Merge. Probably this won't
happen anymore when os64 is being released soon. Nevertheless I wanted you to
ask to again have a look on this issue regarding conditions which use a database
field which is not VARCHAR (I use HSQLDB). I tested an INTEGER field and a DATE
field which both behaved in a way that I got mistrustful whether your fix covers
all ways of using the Conditional Text feature in connection with database fields.

Before I come to my main concern, some introductory notes on the use of a normal
VARCHAR field as Conditional Text content:

Using VARCHAR fields I only experience the bug you were fixing in os64 when I do
a MailMerge. Also I can use EQ, NEQ,.... without problems. When I select a
dataset in the datasource and I choose "Daten in Felder" (probably "data in
fields" in the english version) also everything works alright. So the ELSE
condition bug only happens when you do a MailMerge. The test in the GUI doesn't
cause any mistakes.


Now the interesting part (at least for me :-)). The following things I noticed
using a DATE field:

Let's assume the date_field is not empty

1. Using IF (date_field NEQ "") THEN (date_field) ELSE "" -> "data in fields"
results in an empty field in the document (actually it should be filled)

2. Using IF (date_field NEQ "") THEN "" ELSE date_field -> "data in fields"
results in a not correctly filled field (it should be empty) in the document.

3. Using IF (date_field) THEN (date_field) ELSE "" -> "data in fields" results
in a correctly filled field in the document.

4. Using IF (date_field EQ "") THEN "" ELSE (date_field) -> "data in fields"
results in a correctly filled field in the document.

For me it was interesting to see the behaviour of 1. and 3.. 
- In my version (m122) in the GUI 1. does work with a VARCHAR field (as I also
mentioned in my introduction to the VARCHAR fields) but it does not work with a
date field.
- Using only the field name of the DATE field instead of EQ or NEQ as IF
condition does work (see 3.) in the GUI. This behaviour is contrary to the
VARCHAR fields.


Finally some regards on the INTEGER field (it uses AUTO_INCREMENT and IDENTY):

With this field type I experienced the same behaviour like the DATE field
showed. But there was one difference when I tested the 3. function from above:

Using IF (integer_field) THEN (integer_field) ELSE "" -> "data in fields"
results in an empty field in the document and not as in 3. above in a correctly
filled field!



I don't know whether my information are useful for you or whether they were not
nescessary at all. Only knowing that you definitely fixed at least a part of the
above mentioned issues but eventually not the issues I attached in this mail, I
had the feeling that I should inform you about my experiences. It appeared to me
that there is perhaps more work to do.

Best regards
Helge
Comment 16 Oliver Specht 2005-09-14 08:41:43 UTC
->helgekraak: 
When fields were evaluated there was alway an access to a database and always a
result of the evaluation. No matter if the database connection was valid (from a
merge to fields or a mail merge) or if it has just been created based on the
first database record. 

Now the field's expression is only evaluated if an active database connectino is
already available. 

p.s. It's sufficient to add the id to the CC field to copy the message 
Comment 17 h.ilter 2005-11-14 11:42:58 UTC
Still ok in master 680m139_8974.
Comment 18 Oliver Specht 2006-11-22 14:14:09 UTC
*** Issue 68845 has been marked as a duplicate of this issue. ***