[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libreoffice-users] [SOLVED?] Problem with text formatting in Report.


Greetings,

I think I have a solution. I did some research on the Pentaho report generator that is used in the LO Base Report Generator with emphasis on their formula syntax. The following formula placed in the report field's properties "Data" tab in "Data field..." seems to do what I need:

IF(LEN([Suffix])>0;"-"&[Suffix] ;"")

This tests the length of the text string (Suffix) and if not 0 then outputs the string prefixed with a dash. The ampersand (&) concatenates text strings. If the string length is zero, it outputs the NULL string. I tried outputting the string here without the dash to be sure I got all data, as in:,

IF(LEN([Suffix])>0;"-"&[Suffix] ;[Suffix])

but it fails for some reason, outputting "false"  when the string length is 0 instead.

As I said, it seems to be working, unless I breathe on it!

Thanks for all the suggestions.
Girvin


On 5/15/19 3:17 PM, Girvin Herr wrote:
Greetings,

I am using LibreOffice 5.3.4.2 on Slackware Linux 14.2 (K4.4.75).

I have a database with a text field which may or may not be null. What I want to do is to prefix a dash "-" before the text if the text field is not null. At first, I tried this format:

;;;"-"@

Somewhere, not by me, it got changed to:

[>0]"";[<0]"";"";"-"@

However, this does not work. I get the text when not null, but not the dash in either case.

Is there another way to do this?

Thanks.

Girvin Herr




--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy

References:
[libreoffice-users] Problem with text formatting in Report.Girvin Herr <gherrl@fastmail.com>
Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.