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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strange IF statement

Status
Not open for further replies.

MSBrady

Technical User
Mar 1, 2005
147
0
0
US
Oy!

CR 10
SQL Server 2005

I inherited someone elses report and in the process of discovery I found a weird IF statement:

@Agecolumn1
Numbervar vDaysbetween := {@wAgedate} - {pjinvdet.source_trx_date} ;

If if {pjinvdet.li_type} <> 'D' and {pjinvdet.bill_status} <> 'B' then(vDaysbetween >= {@wAge1from} and vDaysbetween <= {@wAge1to}) Then
{pjinvdet.amount}
Else
0
;

Can someone tell me what the purpose of the double if's might be?
 
2 things:
There are 2 IF's and 2 Then's.
The report functions as intended.
 
Then why are you posting here? It looks poorly written though. I did miss the second then. If you substituted a formula name for the nested formula, it would look like a conventional if/then:

if {@nestedformula} then //=true is implied
{pjinvdet.amount}

-LB
 
I'm posting here b/c I intend to alter it to a more conventional format and I wanted to make sure I didn't miss anything.
 
Are you sure this is the formula? Did you cut and paste it directly from the formula editor to this forum? Is this vb syntax or crystal syntax?

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Crystal syntax cut and pasted directly from the formula.
 
MSBrady,

I think it is equivalent to:

Numbervar vDaysbetween := {@wAgedate} - {pjinvdet.source_trx_date} ;

If {pjinvdet.li_type} <> 'D' and
{pjinvdet.bill_status} <> 'B' and
(vDaysbetween >= {@wAge1from} and vDaysbetween <= {@wAge1to})
Then
{pjinvdet.amount}
Else
0

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top