Only Printing Field if another field is not empty
Delphi 5.1
InterBase
RB 7.03
Our end user reporting solution consists of using a component other than RB
to allow the user to build a SQL statement. That SQL statement is then
plugged into ClientDataSet which is connected to a TppDBPipeline. This
pipeline is used for the report to create the result set (therefore the Data
tab is not visible to the end-user on the designer when creating a report)
This seems to work great for us, except on complex reporting where a single
SQL can't quite return what we need. In these situations I was wondering if
there is a way for the user to be able to create a report where they can say
"If Field A is not empty, then show Field X; but if Field A is empty, show
Field Y".
Here is a specific example of what we are looking for: In our database each
client site has an address; however, each site has the option of using the
main corporate site for mail correspondence (which means instead of sending
reports/letters to the address on the individual site, the report/letter
would go to the main corporate site). So when a report is generated the
users want the address that is printed on the report to reflect where mail
correspondence should go. In the SQL that is generated the user can return
both the address for the specific site, and the address for the corporate
site in the result set. What we need is a way to print only one of those
addresses depending on which addresses should be used for mail
correspondence. Does anyone know of a way the user can control something
like this?
Thanks in advance for any help.
Jeff
InterBase
RB 7.03
Our end user reporting solution consists of using a component other than RB
to allow the user to build a SQL statement. That SQL statement is then
plugged into ClientDataSet which is connected to a TppDBPipeline. This
pipeline is used for the report to create the result set (therefore the Data
tab is not visible to the end-user on the designer when creating a report)
This seems to work great for us, except on complex reporting where a single
SQL can't quite return what we need. In these situations I was wondering if
there is a way for the user to be able to create a report where they can say
"If Field A is not empty, then show Field X; but if Field A is empty, show
Field Y".
Here is a specific example of what we are looking for: In our database each
client site has an address; however, each site has the option of using the
main corporate site for mail correspondence (which means instead of sending
reports/letters to the address on the individual site, the report/letter
would go to the main corporate site). So when a report is generated the
users want the address that is printed on the report to reflect where mail
correspondence should go. In the SQL that is generated the user can return
both the address for the specific site, and the address for the corporate
site in the result set. What we need is a way to print only one of those
addresses depending on which addresses should be used for mail
correspondence. Does anyone know of a way the user can control something
like this?
Thanks in advance for any help.
Jeff
This discussion has been closed.
Comments
I would suggest using an event such as the DetailBand.BeforePrint to check
if a given record is empty. Then you could toggle the visibility of two
DBText components inside the detail band based on this information. If you
would like to give your users the option to control this, you could pop up a
dialog before the report prints to toggle the visibility of these
components.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com