Report Designing!!

Posts   
 
    
rai123
User
Posts: 9
Joined: 02-Feb-2007
# Posted on: 02-Feb-2007 04:49:44   

I just want to know how to use LLBLGen as a dataset to the report designer. I want to design reports but no idea how to set the LLBL as a dataset. Is it possible ..please can someone guide me as iam a total newbie to this stuff....

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 02-Feb-2007 08:17:33   

You can retrieve rows from the database in the form of DataTables (TypedLists, TypedViews & Dynamic Lists), which can be be added to a DataSet.

Please consult the LLBLGe Pro manual: Using the generated code -> SelfServicing/Adapter -> Using TypedViews, TypedLists and Dynamic Lists

rai123
User
Posts: 9
Joined: 02-Feb-2007
# Posted on: 05-Feb-2007 05:55:39   

Walaa wrote:

You can retrieve rows from the database in the form of DataTables (TypedLists, TypedViews & Dynamic Lists), which can be be added to a DataSet.

Please consult the LLBLGe Pro manual: Using the generated code -> SelfServicing/Adapter -> Using TypedViews, TypedLists and Dynamic Lists

Any tutorial on this would be a great help for me to understand.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 05-Feb-2007 07:52:37   

Examples exist on the LLBLGen Pro manual, please check the above mentioned sections.

rai123
User
Posts: 9
Joined: 02-Feb-2007
# Posted on: 06-Feb-2007 07:13:00   

Walaa wrote:

Examples exist on the LLBLGen Pro manual, please check the above mentioned sections.

I am still not clear enough with the exmaples provided in the manual. What iam trying to do is include a report.rdl. Is there a possible way i can set the datasource to llblgen. When i use the form i can see the list of entities in my toolbox..whereas if i use anything else i cannot go through. I want to do a project but iam stucked in the middle. Pliz can som1 guide me out..pliz...i just want to learn this exiciting feature....a example will be of great help to me.

jmeckley
User
Posts: 403
Joined: 05-Jul-2006
# Posted on: 06-Feb-2007 17:34:34   

TypedLists don't have much to do with reporting, in terms of LLBL so the documentation won't have details on how to bind a typed list to a report.

For this you would want to research RPLs and datasource configuration. MSDN and Google would be your best resources.

A TypedList is an extension of a DataTable, so they work exactly the same way. If you can bind a DataTable to a report you can bind a TypedList.

i haven't worked with rpl. I use the Crystal Reports (rpt). With Crystal and DataSets/Tables you must define and use the schema (xsd) of the set/table to design the report. Then at runtime when the actual dataset/table is loaded into the report the information is displayed.

rai123
User
Posts: 9
Joined: 02-Feb-2007
# Posted on: 06-Feb-2007 23:43:00   

jmeckley wrote:

TypedLists don't have much to do with reporting, in terms of LLBL so the documentation won't have details on how to bind a typed list to a report.

For this you would want to research RPLs and datasource configuration. MSDN and Google would be your best resources.

A TypedList is an extension of a DataTable, so they work exactly the same way. If you can bind a DataTable to a report you can bind a TypedList.

i haven't worked with rpl. I use the Crystal Reports (rpt). With Crystal and DataSets/Tables you must define and use the schema (xsd) of the set/table to design the report. Then at runtime when the actual dataset/table is loaded into the report the information is displayed.

Hi, Sorry to bother you. Can i have a sample of crystal report. I will be able to follow coz i am well versed with it. Coz iam totally lost with llbl..it is my boss who sugessted this so i have to do it somehow.

Thank you in advance.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 07-Feb-2007 20:40:06   

A typedlist or a dyn. list are a datatable, so if you can bind a datatable, you can bind a dyn. list or typedlist. We aren't familiar with crystal reports though it should be the same as binding a typedlist/dyn list to a grid.

Frans Bouma | Lead developer LLBLGen Pro
jmeckley
User
Posts: 403
Joined: 05-Jul-2006
# Posted on: 07-Feb-2007 20:47:43   

in a web application:

  • add the App_Code directory if it doesn't exist.
  • add the schema for Typed/DynamicList.
  • add a crystal report to your app.
  • select the .Net ADO dataset you just created.Design your report.

then at run time the load the llbl object as the datasource of the report.

TypedListA data = new TypedListA();
//fetch typed list
ReportDocument.SetDataSource(data);

I would think it's similar in a desktop app.

rai123
User
Posts: 9
Joined: 02-Feb-2007
# Posted on: 08-Feb-2007 00:13:54   

jmeckley wrote:

in a web application:

  • add the App_Code directory if it doesn't exist.
  • add the schema for Typed/DynamicList.
  • add a crystal report to your app.
  • select the .Net ADO dataset you just created.Design your report.

then at run time the load the llbl object as the datasource of the report.

TypedListA data = new TypedListA();
//fetch typed list
ReportDocument.SetDataSource(data);

I would think it's similar in a desktop app.

Sorry to bother you once again. Iam bit confused about how to go about adding adding schema for the Typed/DynamicList. Can you please elaborate more on that how to go about. Thanks in advance

jmeckley
User
Posts: 403
Joined: 05-Jul-2006
# Posted on: 08-Feb-2007 14:50:13   

schemas are just xml text files. I'm sure there's a way via Template Studio to generate the XSD for TypedLists, but I just wrote mine manualy.

Add a dataset file to the App_Code Directory, then right click and add a table, then right click the table and add a column. Use the property window to define the column: Allow Nulls, Data Type, ReadOnly.

I found all you really need is to set is the ColumnName and DataType. Since there readonly you could set this property as well, but it's not required. In this instance the XSD is only used for reporting at design time, It's not used (at least directly by you) at runtime.

here is a sample XSD I use. It's used only to define reports at design time. There are not relationships between tables as each table is a seperate report.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="StandardReports" targetNamespace="http://tempuri.org/StandardReports.xsd" xmlns:mstns="http://tempuri.org/StandardReports.xsd" xmlns="http://tempuri.org/StandardReports.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:annotation>
    <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
      <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
        <Connections>
          <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="MacolaApps" IsAppSettingsProperty="True" Modifier="Assembly" Name="MacolaApps (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.AccountReport.ConnectionString" Provider="System.Data.SqlClient">
          </Connection>
        </Connections>
        <Tables>
        </Tables>
        <Sources>
        </Sources>
      </DataSource>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="StandardReports" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="AC010">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="BrokerId" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
              <xs:element name="Broker" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="CustomerId" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
              <xs:element name="Customer" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="OrderNumber" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
              <xs:element name="OrderDate" msdata:ReadOnly="true" type="xs:dateTime" minOccurs="0" />
              <xs:element name="SalesDate" msdata:ReadOnly="true" type="xs:dateTime" minOccurs="0" />
              <xs:element name="GrossSales" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
              <xs:element name="NetSales" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
              <xs:element name="CommissionAmount" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
              <xs:element name="Balance" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="AC011">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="BatchNumber" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="BrokerId" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
              <xs:element name="Broker" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="CustomerId" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
              <xs:element name="Customer" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="OrderNumber" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
              <xs:element name="PoNumber" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="OrderDate" msdata:ReadOnly="true" type="xs:dateTime" minOccurs="0" />
              <xs:element name="SalesDate" msdata:ReadOnly="true" type="xs:dateTime" minOccurs="0" />
              <xs:element name="ItemNumber" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="Item" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="GrossSales" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
              <xs:element name="NetSales" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
              <xs:element name="CommissionAmount" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
              <xs:element name="CommissionRate" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="AC022">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="BrokerId" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
              <xs:element name="Broker" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="CustomerId" msdata:ReadOnly="true" type="xs:int" minOccurs="0" />
              <xs:element name="Customer" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="ItemNumber" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="Item" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="CommissionRate" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
              <xs:element name="ActiveDate" msdata:ReadOnly="true" type="xs:dateTime" minOccurs="0" />
              <xs:element name="DeactiveDate" msdata:ReadOnly="true" type="xs:dateTime" minOccurs="0" />
              <xs:element name="CreatedBy" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="CreatedOn" msdata:ReadOnly="true" type="xs:dateTime" minOccurs="0" />
              <xs:element name="UpdatedBy" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
              <xs:element name="UpdatedOn" msdata:ReadOnly="true" type="xs:dateTime" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>
rai123
User
Posts: 9
Joined: 02-Feb-2007
# Posted on: 08-Feb-2007 21:39:58   

Hi, Thanks a lot for helping me. i will try this out today. Basically i was stucked up at the dataset part. Now i came to understand that we can create schema to connect those table fields to the report design. But whatever fields we have created in schema should be same as in the typelist. so that in the runtime report and be binded with the typlist. Tell me if iam in the right track. I will try this today and will let you know if iam stucked up .

Thanks for your advice...it think i got a fair idea now. Have a nice day

jmeckley
User
Posts: 403
Joined: 05-Jul-2006
# Posted on: 08-Feb-2007 22:23:41   

exactly... the schema table names/fields must match the typedlist names and typedlist field names.

rai123
User
Posts: 9
Joined: 02-Feb-2007
# Posted on: 11-Feb-2007 21:37:42   

jmeckley wrote:

exactly... the schema table names/fields must match the typedlist names and typedlist field names.

Can anypne help me on how to bind the reportviewer1 to the typlist in the run time to a webform. This is what i did... 1) I created a dataset 2) I binded the dataset to the report in the design view. 3) Then under my webpage the code goes..

public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { TestListTypedList data = new TestListTypedList(); DataAccessAdapter adapter = new DataAccessAdapter(); DataSet ds = new DataSet(); ds.Tables.Add("DataSet1"); ReportViewer1.LocalReport.ReportPath = "Report1.rdlc"; My question is can anyone tell me how can i set the datasource to the report viewer. I tried to use this but it is not working.. ReportViewer1.SetDataSources(data) It gives the error as

Error 1 'Microsoft.Reporting.WebForms.ReportViewer' does not contain a definition for 'SetDataSources' C:\Documents and Settings\jchand\My Documents\Visual Studio 2005\WebSites\TestExample\Default.aspx.cs 36 22 C:...\TestExample\

Please can anyone help me out in this... Thanks is advance.................................................

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 12-Feb-2007 07:31:56   

TestListTypedList data = new TestListTypedList(); DataAccessAdapter adapter = new DataAccessAdapter(); DataSet ds = new DataSet(); ds.Tables.Add("DataSet1"); ReportViewer1.LocalReport.ReportPath = "Report1.rdlc"; My question is can anyone tell me how can i set the datasource to the report viewer. I tried to use this but it is not working.. ReportViewer1.SetDataSources(data)

I don't have any experience with the ReportViewer, but what I understood from this thread is that should fetch the typedList, add it to the dataSet, and then use the dataSet with the ReportViewer. (Not the TypedList).

jmeckley
User
Posts: 403
Joined: 05-Jul-2006
# Posted on: 12-Feb-2007 15:31:49   

The report viewer needs a report datasource object. in the report datasource object you set the DataSet containing the typed list to the report datasource. The viewer grabs this information from the datasource and display the info in the browser.

Think of it as disributed responsibilities. All the report viewer does is display the report. it doesn't know where the report comes from, or what the data is. All it knows is how to display reports. It needs the ReportDataSource to tell it what report to load and where the data comes from.

The report datasource only knows what report to load and how to get the data. It doesn't know what to do with this information once it has the data. The ReportViewer askes the DataSource for this information and the datasource passes it along.

rai123
User
Posts: 9
Joined: 02-Feb-2007
# Posted on: 13-Feb-2007 04:19:54   

jmeckley wrote:

The report viewer needs a report datasource object. in the report datasource object you set the DataSet containing the typed list to the report datasource. The viewer grabs this information from the datasource and display the info in the browser.

Think of it as disributed responsibilities. All the report viewer does is display the report. it doesn't know where the report comes from, or what the data is. All it knows is how to display reports. It needs the ReportDataSource to tell it what report to load and where the data comes from.

The report datasource only knows what report to load and how to get the data. It doesn't know what to do with this information once it has the data. The ReportViewer askes the DataSource for this information and the datasource passes it along.

Can u give the example in codes please...this is what iam doing....

protected void Page_Load(object sender, EventArgs e) { TestListTypedList data1 = new TestListTypedList(); DataAccessAdapter adapter = new DataAccessAdapter(); //adapter.FetchTypedList(data1);

  //ReportDataSource Source1 = new ReportDataSource("DataSet1_PubDates",ObjectDataSource1);
    ReportDataSource source2 = new ReportDataSource();
    source2.Value = adapter.FetchTypedList(data1);

but this give an error = Error 1 Cannot implicitly convert type 'void' to 'object'

Thanks in advance...

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 13-Feb-2007 07:57:43   

source2.Value = adapter.FetchTypedList(data1); but this give an error = Error 1 Cannot implicitly convert type 'void' to 'object'

Did you try to debug your application? FetchTypedList returns void, and as everybody has told you before, you should set the dataSource to a DataSet object.

DataSet ds = new DataSet(); ds.Tables.Add(yourTypedList); // of-course the TypedList should be fetched first.

Then you should use this ds afterwords as the dataSource of the ReportDataSource which you should somehow link to your ReportViewer. (that's what they say)

jmeckley
User
Posts: 403
Joined: 05-Jul-2006
# Posted on: 13-Feb-2007 14:21:08   

aspx

<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" ReportSourceID="source" />
<CR:CrystalReportSource ID="source" runat="server" />

c#

//in your page load, or any other event

ITypedListLgp2 myTypedList = new MyTypedList();
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
      adapter.FetchTypedList(myTypedList);
}

//repeat for each parameter in you report
source.Report.Parameters.Add(myParameter); 

//load typed list
source.ReportDocument.SetDataSource(myTypedList);

there are many more declarative options for crystal report viewer and source. this is what I use to get my reports to display. here is the Crystal of VS2005 forum. they should be able to answer any further questions related to crystal http://forums.asp.net/76/ShowForum.aspx

rai123
User
Posts: 9
Joined: 02-Feb-2007
# Posted on: 14-Feb-2007 00:09:17   

jmeckley wrote:

aspx[code]<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" ReportSourceID="source" />

there are many more declarative options for crystal report viewer and source. this is what I use to get my reports to display. here is the Crystal of VS2005 forum. they should be able to answer any further questions related to crystal http://forums.asp.net/76/ShowForum.aspx

Thankyou so much. Finally i managed to get the reportviewer working with the typedlist. What i did was i placed the typelist data into a dataset and then from the dataset to the reportdatasource . Since reportdataset and typlist dont work together thats y i had to first use the dataset then reportdataset. Thanks a lot. I think I will be able to suceed now..I feel happy.