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

record selection formula is not picking up the newly added condition

Status
Not open for further replies.

gagani

Programmer
Nov 20, 2011
57
GB
I have added a new condition in the crystal report. It is not filtering based on the new criteria but instead filtering with the old criteria.
Record selection formula is as follows:
{ORDERS.SOLDDATE} >= {?from} and {%datepart to} <= {?to}
and {@surveyfee}
and {SALESBRANCHES.BRANCHNAME} = {?branch}

and {ORDERS.ORDERSTATUSID} <> 1 and {ORDERS.ORDERSTATUSID}<>2
and (
({ORDERS.ORDERSTATUSID}<>6)
or
(
{ORDERS.ORDERSTATUSID}=6 and (isnull({ORDERS.DEAD_SUBSTATUS}) = true or {ORDERS.DEAD_SUBSTATUS} = 0)
))
and {ORDERID.userid}={?userid}
Newly added line is {ORDERID.userid}={?userid}. It is not filtering based on the newly added condition.
could anyone help please.
 
Look at Database > Show SQL Query. See what you've got.

Then try displaying {ORDERID.userid} and {?userid} in an extra detail line, to see what you have.

If it is still wrong, break up the selection into a number of separate commands. For instance you could have
Code:
{ORDERS.SOLDDATE} >= {?from} and {%datepart to} <= {?to}

You could then display it in the test section and invoke it as @DateSold in record selection. (No need to say =true)

PS. This is based on Crystal 2008. It helps to give your Crystal version - 8, 8.5, 9, 10, 11, 2008 or whatever. Methods sometimes change between versions, and higher versions have extra options.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
In the SQL query, I could see userid as one of the column in the select statement. In the where condition of the select query, I could just see
conditions related to {ORDERS.ORDERSTATUSID}.

you mentioned as
Then try displaying {ORDERID.userid} and {?userid} in an extra detail line, to see what you have.

Could you please let me know how to display in that way to solve the problem. It is picking up data for all users in the table, but not exclusive to the user. Should I need to do anything else in the report?
Record Selection formula is the criteria to filter in the report, right?
 
I have tried breaking up into separate commands but still giving the same results. I need the results exclusive to one user not for all the users
 
Take out all your other select conditions and just leave

{ORDERID.userid}={?userid}

Does that filter by user id

Ian
 
Please post the code for the formula {@surveyfee} (and any other formula's referred to within that formula).

Cheers,
Pete
 
Try this. Put the new rule at the top of the formula instead of at the bottom. My guess it is getting mixed up into an OR condition because your parenthesis pairs are not right. If that rule works correctly when it is first, then that would be pretty good evidence that the problem is in the AN/OR combinations.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top