Apache OpenOffice (AOO) Bugzilla – Issue 51035
In a Mailmerge Document a conditional textfield doesn't work after trying to "send as pdf via email"
Last modified: 2013-08-07 14:42:16 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.
Reassigned to HI.
- 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.
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.
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
Reassigned for verification re-open issue and reassign to hi@openoffice.org
reassign to hi@openoffice.org
reset resolution to FIXED
Verified with cws os64 = Still occurs.
Back to OS
My mistake. I've verified the second issue instead of the first one, which looks ok.
Back to me re-open issue and reassign to hi@openoffice.org
Set to verified.
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
->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
Still ok in master 680m139_8974.
*** Issue 68845 has been marked as a duplicate of this issue. ***