I do not understand how StiDataBand.DataSourceName works when using DataSets. I have a DataSet with 5 tables that have DataRelations set up. I would like to be able to add data to the StiDataBand from my main table and also the 4 tables that are related to it.
I tried setting StiDataBand.DataSourceName to the name of my DataSet (dataBand.DataSourceName = ds.DataSetName). That did not work.
Then, I tried setting it to the name of one of my tables in the dataset (dataBand.DataSourceName = ds.Tables[0].TableName). That worked. However, I seem to be able to add data to the band from any table in the dataset. So, why do you have to set it to the name of a table?
Also, when would I need to set the DataRelationName property?
Thanks,
Sandy
StiDataBand.DataSourceName
-
- Posts: 62
- Joined: Mon Dec 11, 2006 1:43 pm
- Location: U.S.A.
StiDataBand.DataSourceName
That correct. One Databand = one table. For example if table have 10 rows then databand will be output to result page 10 times.
If you need output two tables palce two databands. If you need output master-detail report then you need place two databands -
master band and detail band. Set DataSourceName of each databand to equal tables. After then set property MasterComponent
of DataBand2 to DataBand1 and set property RelationName of DataBand2 to your relation name.
Please visit following page: http://www.stimulsoft.com/LiveDemos.aspx
For output fields on report you need place textbox on any databand (or directly on page). After then in property Text write:
{NameOfTable.NameOfField}
If you need generate report from code please see sample project - PrintGrid and PrintTable.
Let me know if you need any help.
Thank you.
If you need output two tables palce two databands. If you need output master-detail report then you need place two databands -
master band and detail band. Set DataSourceName of each databand to equal tables. After then set property MasterComponent
of DataBand2 to DataBand1 and set property RelationName of DataBand2 to your relation name.
Please visit following page: http://www.stimulsoft.com/LiveDemos.aspx
For output fields on report you need place textbox on any databand (or directly on page). After then in property Text write:
{NameOfTable.NameOfField}
If you need generate report from code please see sample project - PrintGrid and PrintTable.
Let me know if you need any help.
Thank you.
-
- Posts: 62
- Joined: Mon Dec 11, 2006 1:43 pm
- Location: U.S.A.
StiDataBand.DataSourceName
Thanks Vital.
I was able to get what I wanted by using DataRelations in my DataSet. However, my users are not technical and will not understand the concept of "joins" and SQL. The report designer displays my tables A, B, C. Then, because I have DataRelations set up it also displays tables B & C under table A. In order for the join to happen, the users will have to select fields from the tables listed underneath table A. Is there a way to just display table A and its DataRelations. In other words, I just want to show the A tree branch with B and C as child nodes, but I don't want tables B and C to appear as separate tree branches.
Thanks,
Sandy
I was able to get what I wanted by using DataRelations in my DataSet. However, my users are not technical and will not understand the concept of "joins" and SQL. The report designer displays my tables A, B, C. Then, because I have DataRelations set up it also displays tables B & C under table A. In order for the join to happen, the users will have to select fields from the tables listed underneath table A. Is there a way to just display table A and its DataRelations. In other words, I just want to show the A tree branch with B and C as child nodes, but I don't want tables B and C to appear as separate tree branches.
Thanks,
Sandy
StiDataBand.DataSourceName
You can add restrictions to report dictionary. For example, to prevent show datasource "Categories" you can use
following code:
Thank you.
following code:
Code: Select all
report.Dictionary.Restrictions.Add("Categories", StiDataType.DataSource, StiRestrictionTypes.DenyShow);