auto relation in Data Bands

Stimulsoft Reports.NET discussion
munishsethi
Posts: 20
Joined: Fri Jun 01, 2007 11:10 pm
Location: India

auto relation in Data Bands

Post by munishsethi »

I hav two tables Addresses and Phones and they are very much related to each other(in dataset).
Now while designing a report, i want these two's bands to be auto related, rather assigning them bands relations manually..
How can i achieve this???


Comment.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

auto relation in Data Bands

Post by Vital »

Please explain your question in more details.

Thank you.
munishsethi
Posts: 20
Joined: Fri Jun 01, 2007 11:10 pm
Location: India

auto relation in Data Bands

Post by munishsethi »

Vital my question was regarding generating relations in between data bands.

See generally if we have two tables and try to create a report placing both these bands. Then we have to create a relation in between these two databands to get the related data. But my client dont want to manually go and assign relations, can we do it programmatically??

With creating relation i mean, relations between databands.

did u got my question now?
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

auto relation in Data Bands

Post by Vital »

Ok. I understand what you want. I give you answer later.

Thank you.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

auto relation in Data Bands

Post by Edward »

In the Stimulsoft Reports.Net connection to data is proceed via DataSources.
Each DataSource belongs to some Connection. So when Connection to data is set and DataSource uses this Connection, we able to use a DataBand.
Relations between DataSources - it is the same as Relations between Tables in ADO.Net.
Each DataBand may be linked to the DataSource or may be rendered fixed number of times (CountData property) when DataSource is not assigned.

What do you mean when you write "relations between databands" ?
1. We can add relations to DataSources programmatically and in designer as well.
2. We can assign existing Relations of the DataSources to Databands and link them in this way.

Anyway we cannot link DataBands in the Master-Detail scheme without using Relations of DataSources.

So describe your aim more clearly, please.

Thank you.

munishsethi
Posts: 20
Joined: Fri Jun 01, 2007 11:10 pm
Location: India

auto relation in Data Bands

Post by munishsethi »

[img]C:\Documents and Settings\Munish Sethi\My Documents\My Pictures\screenshot.jpg[/img]
munishsethi
Posts: 20
Joined: Fri Jun 01, 2007 11:10 pm
Location: India

auto relation in Data Bands

Post by munishsethi »

I m attaching two screenshots, In FIRST one, i am trying to establish Data Relations, this is what i was referring to when i was saying 'Relations in DataBands'. So assist me make these relations programmatically and not manually in Designer.

Here is another screenshot in which im trying to assign a Master Component to a databand. I want this even to be done programatically. How can i do that?
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

auto relation in Data Bands

Post by Edward »

Please send screenshots to Image. Your images couldn't be attached in the way you've done it.

Master Component to a DataBand can be assigned in the following way:

Code: Select all

DetailDataBand.MasterComponent = MasterDataBand;
Relations can be added programmatically too:

Code: Select all

StiReport report = new StiReport();
DataSet ds = new DataSet("Demo");
ds.ReadXmlSchema("demo.xsd");
ds.ReadXml("demo.xml");
report.RegData(ds);
report.Dictionary.Synchronize();

// this code adds a relation between Categories DataSource (Parent) and Products DataSource (Child)
StiDataRelation dataRelation = new StiDataRelation("MyRelation", report.Dictionary.DataSources["Categories"], report.Dictionary.DataSources["Products"], new System.String[]{"CategoryID"}, new System.String[] {"CategoryID"});
report.Dictionary.RegRelations();
report.Dictionary.Relations.Add(dataRelation);

report.Design();
Thank you.
ngaheer
Posts: 44
Joined: Sat Jul 22, 2006 1:12 am
Location: San Jose

auto relation in Data Bands

Post by ngaheer »

Hi Edward,

I guess the question still might not be clear, so here is a further explanation of what we are trying to do: -

1. We are registering a data source with the report which has three tables i.e. Master, address and Phones. When we register the data source, we also create StiDataRelation between these three tables.

2. When we open the designer for report design, under Data Sources, we do see our registered data source and I can see that relations we constructed between Master, Addrss and Phones is visible in the Data Sources window.

Now when I drag Master band and then drag Address Band, I have to again manually Select the Data relation on the Address band and select Master Band as the data relation.


What we were hoping that the relationship could be set programmatically (after the bands have been placed) or if there was a way to tell Stimulsoft to automatically set the Data Relation on the band when it is placed because relations already exist between data sources.

I can email screenshots if it is still not clear.

Thanks for your help in this case.

Narinder.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

auto relation in Data Bands

Post by Edward »

Ok your request is much more clear now. We need time to give you a nice answer.

Our thought about solutions is following:

1) To provide an event which could be used when a user places a band on the reports page.

2) In the final version 2007.2 we provide a new wizard which is run automatically when the DataSource is dragged from the Dictionary to the page of the report.
We could extend the wizard in the direction of linking with bands which are placed above the current DataBand. Sometimes may be more than one available Master DataBand for the Detail and when the user able to choose which master should be used from available DataSources (and bands) it is more flexible solution.

What do you think? Which of the methods suits your needs more and what is your suggestions about these methods?

Thank you.
Post Reply