Expression Building

edited March 2003 in General
Dear Group

I am a first time user of this report designer. I have an invoice template
which I would like to alter. It is the Name and Address part that I wish to
change. At the moment it looks as follows and is bound to my orders table.

invoice name
invoice address 1
invoice address 2
invoice state
invoice zip

Each of the above fields are in their own dbtext box. What I would like to
do is make it so the address can be trimmed as in MS Access. Therefore I
wish to build an expression that will cut out parts that are not applicable
to some addresses. For example shorter addresses that do not have any value
for address 2. I would like the expression to shift the invoice state up to
the next line automatically. Therefore this does not leave my invoice with
a blank line between address 1 and state. If there is a way that I can just
build an expression that does this in a dbtext box then please let me know
how. I have read some of the learnreportbuilder.pdf but can not seem to
find much on this. The part I can see in the mailing labels section about a
calcs tab which I can not seem to find. Please if anyone can offer any
help, or maybe even a template with this sort of expression in so I can see
it.

Thanks in advance to any that help.

Kind Regards

Fay

Comments

  • edited March 2003
    Fay,

    Check out Demo 33 at \RBuilder\Demos\1. Reports\dm033.pas. This shows an
    example of how to remove extra white space in an address when needed.

    Nico Cizik
    Digital Metaphors


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2003
    Thanks Nico

    I only have a download of Learn RepotBuilder and I can't see and demo files
    with it? Could you send it to me?

    Thanks again

    Fay

  • edited March 2003
    Fay,

    If you are an end-user, you may be able to use RAP to code the events needed
    for this task. Below is an example of code that must be entered used to do
    this. You can learn more about using RAP as an end-user by refering to the
    Learning ReportBuilder program you downloaded.

    If you are evaluating ReportBuilder, you can download the trial version of
    ReportBuilder Enterprise from http://www.digital-metaphors.com and all demo
    files will be included with the install. Remember, to evaluate
    ReportBuilder you will need Delphi 5 or higher.

    procedure Memo1.OnPrint;
    var
    lsLine: String;
    lsState: String;
    lsZIP: String;
    begin

    {clear memo}
    Memo1.Lines.Clear;

    {add contact}
    lsLine := plCustomer['Contact'];
    Memo1.Lines.Add(lsLine);

    {add company}
    lsLine := plCustomer['Company'];
    Memo1.Lines.Add(lsLine);

    {add address line1}
    lsLine := plCustomer['Addr1'];
    if lsLine <> '' then
    Memo1.Lines.Add(lsLine);

    {add address line2}
    lsLine := plCustomer['Addr2'];
    if lsLine <> '' then
    Memo1.Lines.Add(lsLine);

    {add city, state zip}
    lsLine := plCustomer['City'];
    lsState := plCustomer['State'];
    if lsState <> '' then
    lsLine := lsLine + ', ' + lsState;
    lsZIP := plCustomer['ZIP'];
    if lsZIP <> '' then
    lsLine := lsLine + ' ' + lsZIP;
    Memo1.Lines.Add(lsLine);

    {add country}
    lsLine := plCustomer['Country'];
    Memo1.Lines.Add(lsLine);

    end;


    Nico Cizik
    Digital Metaphors

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.