问题
I have a list of integer values(employee IDs) which i need to pass to a Crystal Report. I am using a Action class to pass these values. So far i have succeeded with passing a single value but i couldn't find a way to pass a list of values.
Fields fields = new Fields();
Values vals1 = new Values();
ParameterFieldDiscreteValue pfieldDV1 = new ParameterFieldDiscreteValue();
pfield1.setName("fromDate");
pfieldDV1.setValue(start_Date);
vals1.add(pfieldDV1);
pfield1.setCurrentValues(vals1);
fields.add(pfield1);
CrystalReportViewer viewer = new CrystalReportViewer();
//some code to set CrystalReportViewer settings
viewer.setParameterFields(fields);
By this way i was able to get the fromDate value into the Crystal Report. Does any one know how to get a this kind of list
int employeeList[]
Or a
String[] empListOptions
Thanks in advance.
回答1:
foreach (string in string_array)
{
param.Value = string;
report.ParameterFields[parameter].CurrentValues.Add(param);
}
Found here: http://www.logicaltrinkets.com/wordpress/?p=227
来源:https://stackoverflow.com/questions/13401421/how-to-pass-a-list-of-values-into-a-crystal-report