Conditional Text referencing database fields

I’m using writer with database fields quite often but somehow from version to version the conditional text fields referencing a db field is not working any more.

Example:

  • registered db name: mydb
  • db name in mysql backend: crm
  • table name: offers
  • column name: gender

when drag&drop from the datasource table the column into the writer text I can fill the column values from a selected row to the fields. The field for the dropped column is references as mydb.crm.offers.gender.

In previous versions I was able to use conditional text fields e.g. to generate salutation dynamically based on the db field gender EQ "m" then use Mister else Madam.
In later versions I had to change the formular to crm.offers.gender == "m" but in version 7.5.3.2 the conditional text field always validates to TRUE (Mister).

Is this feature broken or has the syntax changed (again)?

Thanks!

btw: nowadays it would be much nicer to have a REST data source instead of a jdbc db source. Maybe someone is already working on something like that?

found it:
instead of crm.offers.gender I now have to include the registered db name as
mydb.crm.offers.gender (including the registered LO db name) and instead of just hitting F9 I need to fill the fields from the datasource again.

Thanks for reading …

saved my day, thanks!!

For whoever might stumble upon a similar issue: I have address fields with to distinct address lines (Address_Line_1 and Address_Line_2). In most cases Address_Line_2 is empty, but some countries do use that field. I wanted my document to omit Address_Line_2 in case it’s empty (= not showing a weirdly-looking empty line in the address field)

My solution looks like this:

<First_Name> <Last_Name>
<Address_Line_1>[conditional-field]<Address_Line_2>

With [conditional-field] being a conditional text field:
Condition: filename.tablename.Address_Line_2 !=""
Then: xxxxxx
Else: (empty)

The trick is now to replace xxxxxx with an xml newline character ( source: https://forum.openoffice.org/en/forum/viewtopic.php?t=84412):

  1. save the document as Flat XML ODF Text Document (.fodt)
  2. open the .fodt with a text editor, replace “xxxxxx” with " "
  3. re-open the .fodt document with LibreOffice and enjoy the fact that the conditional field is now rendered as a newline : )
  4. save the document as a binary .odt file again, if you prefer that (.fodt tends to crash for me sometimes)