Board index » delphi » Help with expression syntax

Help with expression syntax

I have two separate fields in a table for company name - company1 and
company2. On an invoice I want to print Company1 if it isn't null or
company2 if company1 is null on the same line.  I am having trouble with
the IF syntax for the expression. Can anyone help me out with this?
Thanks.
 

Re:Help with expression syntax


In article <37CEB20E.9AEB6...@beaverplastics.com>, Rhea Urusky
<rh...@beaverplastics.com> writes
Quote
>I have two separate fields in a table for company name - company1 and
>company2. On an invoice I want to print Company1 if it isn't null or
>company2 if company1 is null on the same line.  I am having trouble with
>the IF syntax for the expression. Can anyone help me out with this?
>Thanks.

Not sure what you mean by expression, but If a QRDBText object CoName is
on a band of a Quickrep (datafield set to co1) try adding code to the
BeforePrint event of the band, something like:
if table['co1'] ='' then
CoName.datafield := table['co2']
else
CoName.datafield := table['co1'];
last line needed (I think) to reset for each occurrence.
HTH
--
Neville Wright

Re:Help with expression syntax


You can try the OnPrint event for the component. You would need to code it
something like this:

    if value = '' then
       value := tblName.FieldByName('Company2').asString;

Give this a try

Good Luck - John

johndema...@mi-assistant.com

Quote
Rhea Urusky wrote in message <37CEB20E.9AEB6...@beaverplastics.com>...
>I have two separate fields in a table for company name - company1 and
>company2. On an invoice I want to print Company1 if it isn't null or
>company2 if company1 is null on the same line.  I am having trouble with
>the IF syntax for the expression. Can anyone help me out with this?
>Thanks.

Other Threads