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+unsubscr...@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

Reply via email to