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!

SQL within Record Selection Formula.

Status
Not open for further replies.
May 5, 2004
29
GB
Can I build up a SQL where statemant? i.e.
can I do this :

the_where_action := "{JOBS.CONTRACT_NO} = {?contract_no}"
+ " and {JOB_TYPES.ORDER_TYPE} = 'R'"
+ " and {ADMIN.PRIORITY} <> '4'";

and then excecute the_where_action for the select query?
Is there another way I can add to or take away from the
where clause of the query within the formula environment at excecution time?

Thank you.
 
Crystal passes the where clause by using the Report->Selection Formulas->Record.

{JOBS.CONTRACT_NO} = {?contract_no}
and {JOB_TYPES.ORDER_TYPE} = 'R'
and {ADMIN.PRIORITY} <> '4'

It does not execute dynamic SQL.

Depending upon your version of Crystal, you can also paste in a query, and apply parameters in a Command object.

Remember to take the time to post technical information:

crystal version
database/connectivity used

-k
 
Hi,
Use user entered/selected parameters for the values and have 'ALL' as a default value..

Then your record selection formula could be something like
Code:
(
if {?contract_no} = 'ALL' then
True 
else
{JOBS.CONTRACT_NO} = {?contract_no}
)

and

(
If {?OrdType} = 'ALL'
then
True 
else
{JOB_TYPES.ORDER_TYPE} = {?OrdType}
)

and

(
If {?Priority} = 'ALL' 
then
True
else 
{ADMIN.PRIORITY} = {?Priority}
)


Should give you some idea of how to make it work for your situation..




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi,
My posting assumed you wanted to filter in the report, not when building a recordset...




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Turkbear, that's exactly what I wanted, much thanks my man/gal, by the way is there a CR10/11 manual that goes into this? Most of them seem to just skim the surface.
Again thank you sir.
 
Hi,
No problem..Glad to help..
( Man, by the way )

Synapse's FAQ on passthroughs should be a shortcut on your Crystal development desktop - it is on mine ( altho' I sometimes fall back into bad habits)



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top