Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using 'and' with 'If-Else' statements

Status
Not open for further replies.

kpetree10

IS-IT--Management
Jun 15, 2007
57
US
Hi, I've got a record selection formula that looks like this...

If{?Shop Order}<>'' Then
{?Shop Order}=(trim({mctrxhst_sql.ord_no})) Else
{mctrxhst_sql.ord_no}<>'' and
{?Date}={mctrxhst_sql.trx_dt} and
If {?Work Center}<>'' Then
{?Work Center}={mctrxhst_sql.wc}
else {mctrxhst_sql.wc}<>'' and
If {?Operation Type}="Production" Then
{sfdtlfil_sql.wc_load_cd} <> "S"
Else
{sfdtlfil_sql.wc_load_cd} <> "O" and
{mctrxhst_sql.rec_type} = "O" and
If {?Employee Number}<>0 Then
{?Employee Number}={hzempper_sql.EMP_NO}
else {hzempper_sql.EMP_NO}<>0 and
If {?Work Center}<>'' Then
{?Work Center}={mctrxhst_sql.wc}
else {mctrxhst_sql.wc}<>''

My problem is that if one of the If statements is true it doesn't continue the 'and' statement and finish the formulas, it just stops there but for the report to work it has to complete all the formulas. How can I write this so weither the outcome of the If statement it will finish the whole fomula?

Thank You!
 
(
If {?Shop Order}<>'' Then
{?Shop Order}=(trim({mctrxhst_sql.ord_no})) Else
{mctrxhst_sql.ord_no}<>''
) and

{?Date}={mctrxhst_sql.trx_dt} and

(
If {?Work Center}<>'' Then
{?Work Center}={mctrxhst_sql.wc} else
{mctrxhst_sql.wc}<>''
) and
(
If {?Operation Type}="Production" Then
{sfdtlfil_sql.wc_load_cd} <> "S" Else
{sfdtlfil_sql.wc_load_cd} <> "O"
) and

{mctrxhst_sql.rec_type} = "O" and //[red]not sure whether this belongs with the previous "else" clause[/red]

(
If {?Employee Number}<>0 Then
{?Employee Number}={hzempper_sql.EMP_NO}
else {hzempper_sql.EMP_NO}<>0
) and
(
If {?Work Center}<>'' Then
{?Work Center}={mctrxhst_sql.wc} else
{mctrxhst_sql.wc}<>''
)

-LB
 
Thanks lbass! I knew it would be something simple like that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top