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

Using Formula in SQL Select

Status
Not open for further replies.

MikeCopeland

Programmer
May 21, 2007
91
US
Using CR 8.5...

I need to use the result of a formula I've developed as a component of my Select statement - the formula is named isOkay and returns values of 1-4. My current "where" clause is:
WHERE Referral."ClientLastName" <> 'TEST'
to which I want to add
"AND @isOkay = 4".
I get runtime errors when I try this, so I'm sure I have the syntax wrong... I can't find any reference in the Help for such a technique. Any thoughts? TIA
 
What is the content of your formula {@isOkay}?

-LB
 
// @isOpen
if (isNull({Referral.Closed})) then 4
else
if (isNull({ReferralHistory.CloseReasonKey})) then 2
else
if ({ReferralHistory.CloseReasonKey} = 0) then 3
else 4
 
Go to report->edit selection formula->record and enter:

{Referral.ClientLastName} <> 'TEST' and
(
isnull({Referral.Closed}) or
(
not isnull({ReferralHistory.CloseReasonKey}) and{ReferralHistory.CloseReasonKey} <> 0
)
)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top