Crystal Report - From stored proc. to unbound fields

M

Mike

Hi all,

I'm actually filling a report created with CR, using a stored proc.
The
data is returned in an ouput parameter of ref cursor type,
and retrieved from a dataset using ADO. To display the data on the
report,
i used unbound fields, as i have single values only. Meaning, my
dataset has
one row but with multiple columns, each of them, bound to my unbound
fields.
Those unbound fields were added to the Header section of the report,
as they
need to be displayed only once. That works perfectly, i bound them
using this
code from a class :

FormulaFieldDefinitions fielddefs;

fielddefs = myrpt.DataDefinition.FormulaFields;

DataRow r = ds.Tables[0].Rows[0];
foreach(FormulaFieldDefinition f in fielddefs)
{
f.Text = r[f.Name].ToString();
}
Reportviewer.ReportSource = myrpt;
The name of each unbound field, has got the same name of the column
name in my dataset.

Ok, my question is, assuming i would now have several rows in my
dataset, the
data should normally be displayed in the details section. So , how to
bind
my unbound fields to the dataset in this case ? I've tried the
SetDatasource
method, but it didn't work.
Any Idea ?
Thanks,
Mike
 
M

Mike

Well i got it after some tests and documentation. My approach was not
right in fact. First of all from the data returned in xml format (clob
parameter) from my proc., i genereated an xml schema file. This was
done very easily using the xmltextwriter stuff from .Net. Then, from
the design of my report, i added a new connection, selected the
ADO.NET(XML) from the more data sources tab and selected the generated
file.
I was then able to see the available columns (only the definition no
data), which correspond each xml field returned in my clob parameter
from the proc.
I had to drag and drop the one i wanted on my report. Then from the
code, using the setdatasource method from the report class worked
perfectly.

I was not getting the whole concept before, now it's done !!
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top