TOPIC: Skipping Blank Lines in a Report
#956
Skipping Blank Lines in a Report 3 Years, 1 Month ago
This is a line from my report code:

Code:


#('Horz'
('Text' " "             width:6   font:'(name: Ariel size:10))
('Text' "Mail Address:" width:14  font:'(name: Ariel size:10) color:0xff0000)
(mailAddress            width:225 font:'(name: Ariel size:10) color:0xff0000)
)



How do I get it to print nothing, not even a blank line, if mailAddress is ""?
 
 
#957
Re:Skipping Blank Lines in a Report 3 Years, 1 Month ago
There are several approaches you can take depending on what you're trying to do. The simplest is probably to build your format with code.

In a QueryFormat, you can't do this in Output because it's only called once, to get the format for subsequent records. But you can return false from Output and do it in BeforeOutput or AfterOutput

Code:

AfterOutput(data)
    {
    return data.mailAddress is ""
        ? false
        : #(Horz ...)
    }



Note: I haven't run this code so there may be typos or other mistakes.

Another approach would be to make your own format, derived from Generator or InputFormat that produced either nothing or your Horz, depending on the data passed to it.
 
 
andrew
 
#958
Re:Skipping Blank Lines in a Report 3 Years, 1 Month ago
andrew wrote:

Another approach would be to make your own format, derived from Generator or InputFormat that produced either nothing or your Horz, depending on the data passed to it.


Well, that's beyond my current ability ;) , but "the simplest" works for me because it is the last line before we get to the linked data.