query regarding parameters(in crystal reports)

srivalli

Well-known member
Joined
May 4, 2005
Messages
189
Programming Experience
Beginner
i have one table called "employee"
i want to display the details of the employees whose job position is "sales representative"
only.
i am trying using parameters fields but i am getting all the employees irrespective of my selection.
so plsss suggest what is the code
 
what is the name of the field that holds this job positions?
Ok let me assume for a while. :) i.e. it's named "Positions" .... 1st, you should make a new parameter with sucha name (@Positions) ... while you load the reports add a value to parameter ...

PHP:
 {...} 
document.SetParameterValue("Positions", "sales_representative")
{...}


Cheers ;)
 
query in crystal reports

the code u gave is generating error stating that
"undefined function "setparametervalue" .

i want the query in crystal reports 10
i need to whether i need to write in "parameter field" or in "sqlexpressionfield"
and which formula i need to use.
thank u
kulrom said:
what is the name of the field that holds this job positions?
Ok let me assume for a while. :) i.e. it's named "Positions" .... 1st, you should make a new parameter with sucha name (@Positions) ... while you load the reports add a value to parameter ...

PHP:
 {...} 
document.SetParameterValue("Positions", "sales_representative")
{...}


Cheers ;)
 
Hi,
since you are trying to retreive records with specific value, I think you have to use RecordSelectionFormula. see example below:

rpt.RecordSelectionFormula = "{tbl_UC142_4.UC142_4_ContributionYear}=" & cboYears_P4.Text & " AND {tbl_A_Assignments.A_AssignmentID}=" & gintAsgnID


give the tablename.fieldname = "sales representative"


Hope this helps.



 
Message' is not a member of 'exception

Hi,

Thanks for your sample project code. But when I run this project following errors appears in build error. and there is underline in ex (ie: catch ex as exception).

'Catch' cannot catch type 'exception' because it is not 'System.Exception' or a class that inherits from 'System.Exception'.

'Message' is not a member of 'exception'

Also the report viewer displays db log in diologue box.


Do you have solution to that?

Thanks
 
Dim SalesRep As New CrystalReport1
Dim Position as String = "sales representative"
SalesRep.SetParameterValue("Position", Position)
CrystalReportViewer1.ReportSource = SalesRep
CrystalReportViewer1.Refresh()


In the report you have a string parameter named "Position" and in the record selection formula you would have:

{DatasetName.FieldName} = {?Position}
 
Back
Top