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

Crystal report formula

Status
Not open for further replies.

jrs11

Programmer
Mar 1, 2002
8
US
Hi. I am having trouble getting a formula to work via ASP to crystal. I am passing a parameter, but when the parameter is passed it scans the whole SQLServer table verus a direct hit on the keyed field. Any suggestions???
 
Not all CR formulas can be converted to SQL. If not, the selection is performed on the client.

Post your formula, and clarify if this is the "SELECTION" formula or a formula field. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Formula is a very simple field:

{T_Emp_Basic_Info.SSNO}

Using selectionformula code in VB to pass social security number to CR

However....this process scans the whole table versus when a parameter prompt is used in CR, I get a direct hit.
 
Passing just a single field name to the selection formula won't do anything. Is that all you are passing? Could you post the line of code that passes the formula? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
here is the vb code I use to pass to CR


sCriteria = ""
For i = 0 To gResults.ListCount - 1
If gResults.Selected(i) Then
sCriteria = sCriteria & "({@fSSN}) = '" & Left(gResults.List(i), 10) & "' or "
End If
Next

sCriteria = Left(sCriteria, Len(sCriteria) - 4)
Debug.Print sCriteria

CrystalControl.ReportFileName = "emp_prof.rpt"

CrystalControl.SelectionFormula = sCriteria



my formula is denoted as @fSSN and just contains
{T_Emp_Basic_Info.SSNO} when you edit the formula

I am new with CR so while I was tinkering this is how I got it to work. Would appreciate any suggestions??!?!?! or help!!!! Thanks
 
You have 2 formulas here, one is @ssn which sits in the report, the other is the selection formula that gets passed to the report. Post the selection formula, or the contents of the SCriteria variable at the time it is passed to the report.

If it has OR in it, then it will always have to do a serial read. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
"({@fSSN}) = '0123456789'"

is what is contained in the sCriteria before it is passed to cr
 
Try passing:

" {T_Emp_Basic_Info.SSNO} = '0123456789' " Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top