Page 1 of 3

Two Relations with the same name in datasource

Posted: Fri Sep 24, 2021 12:43 pm
by thomasRi
Hello, I'm using a DataSet as source for the report.
The DataSet has a few relations, but all with diferent names. But in the datasource in report two relations have the same name. (Name in datasource is different, but not the name). This causes an error in the viewer. How can I influence this? Where does this name came from?
My designer version isr 2021.3.4
Thanks in advance

Re: Two Relations with the same name in datasource

Posted: Mon Sep 27, 2021 1:35 pm
by Lech Kulikowski
Hello,

Please clarify how do you add these relations?

Thank you.

Re: Two Relations with the same name in datasource

Posted: Tue Sep 28, 2021 7:58 am
by thomasRi
Hi, thats the code how I add the relation. The name of the relation is always different to the others. I've tried variants without exception, but the behavior is the same. The property "Name in datasource" is in both relation correct, but not the property "Name is the same.
Thanks Thomas


DataRelation relation =
new DataRelation(
ownTableName + "_" + atrDescr.OwnPropertyName + "_" + otherTableName,
parentColumn,
childColumn, false);
try
{
// if (reportDataSet.Relations.Contains(relation.RelationName) == false)
reportDataSet.Relations.Add(relation);
}
catch (Exception)
{
try
{
// this can be happen if 2 relations to the same type are defined, for instance visit <-> person
string ownPropName = atrDescr.OwnPropertyName;
relation.RelationName = ownTableName + "_" + ownPropName + "_" +
childColumn.ColumnName;
// if (reportDataSet.Relations.Contains(relation.RelationName) == false)
reportDataSet.Relations.Add(relation); // log message if something went wrong !
}
catch (Exception ex1)
{
Log.Debug("Can't create relation \"" + relation.RelationName + "\"in report data set", ex1);
}

Re: Two Relations with the same name in datasource

Posted: Wed Sep 29, 2021 7:55 pm
by Lech Kulikowski
Hello,

Please send us a sample project that reproduces the issue for analysis.

Thank you.

Re: Two Relations with the same name in datasource

Posted: Thu Sep 30, 2021 9:33 am
by thomasRi
Hi, I'll do it, but it is complicated to make a project wich is intepentend for our database an for other projects.
Perhaps this information will help.
Both of those relations are between the same two tables, but the property is different.(this is needed because of the internal structure)
If I do the same thing windowsDesigner, not the webDesigner, ist works as expectet (see att., Name and Name in Datasource are identical.
Perhaps this will help
Thanks Thomas

Re: Two Relations with the same name in datasource

Posted: Mon Oct 04, 2021 9:58 pm
by Lech Kulikowski
Hello,

It is difficult to say something without a sample.

Thank you.

Re: Two Relations with the same name in datasource

Posted: Mon Oct 25, 2021 10:18 am
by thomasRi
Hi again, sorry for the delay
If you start the attached sample project you can see the double names in the datasource, as shown in the earlier posted screenshot. (Screenshot_2.png)
The solution is based on the sample on your webpage.
Thanks in advance
Thomas

Re: Two Relations with the same name in datasource

Posted: Mon Oct 25, 2021 11:44 am
by Lech Kulikowski
Hello,

There are no projects in attachments.

Thank you.

Re: Two Relations with the same name in datasource

Posted: Tue Oct 26, 2021 5:19 am
by thomasRi
But now, I think

Re: Two Relations with the same name in datasource

Posted: Wed Oct 27, 2021 9:51 pm
by Lech Kulikowski
Hello,

We couldn't reproduce the issue. Please provide more detailed information.

Thank you.