SynchronizeBusinessObjects
-
- Posts: 32
- Joined: Tue Jul 03, 2012 2:16 pm
SynchronizeBusinessObjects
Hello.
We are using reports with Business Objects, where the data comes from a customized data source.
The objects are build in memory, and then are registered as the following:
myReport.RegBusinessObject(dataSourceName, myData);
myReport.Dictionary.SynchronizeBusinessObjects(50);
myReport.Dictionary.BusinessObjects.Sort(StiSortOrder.Asc, true);
Generally, it Works fine.
But sometimes occurs of the data source changes, and when I'm editing na already existing report, it loads the new data source, but also keeps the old ones.
The only way I found to solve this, was calling "myReport.Dictionary.BusinessObjects.Clear();" right before I register my data.
Ok, It works fine.
But the bands in my report lose their configs.
I debugged the code, and found out that the bind are made by the BusinessObject's ID, and not by it's name, and doing that was giving it a new ID, what makes sense.
So, I wanted to know two things:
1) Why SynchronizeBusinessObjects() are just adding new objects and properties, but not removing the old ones?
2) What could I do to solve that?
Thanks.
We are using reports with Business Objects, where the data comes from a customized data source.
The objects are build in memory, and then are registered as the following:
myReport.RegBusinessObject(dataSourceName, myData);
myReport.Dictionary.SynchronizeBusinessObjects(50);
myReport.Dictionary.BusinessObjects.Sort(StiSortOrder.Asc, true);
Generally, it Works fine.
But sometimes occurs of the data source changes, and when I'm editing na already existing report, it loads the new data source, but also keeps the old ones.
The only way I found to solve this, was calling "myReport.Dictionary.BusinessObjects.Clear();" right before I register my data.
Ok, It works fine.
But the bands in my report lose their configs.
I debugged the code, and found out that the bind are made by the BusinessObject's ID, and not by it's name, and doing that was giving it a new ID, what makes sense.
So, I wanted to know two things:
1) Why SynchronizeBusinessObjects() are just adding new objects and properties, but not removing the old ones?
2) What could I do to solve that?
Thanks.
Re: SynchronizeBusinessObjects
Hello.
We are considering the issue now.
We will let you know when the solution will be available.
Thank you.
We are considering the issue now.
We will let you know when the solution will be available.
Thank you.
Re: SynchronizeBusinessObjects
Hello, Daniel.
If you register new Business Object and there is already one, the new business object will be created. Now we have added a new option:
By default, it will be true. And the new Business Object with the same name as the existed will replace the last.
You don't have to clear dictionary and synchronize business objects now.
Let us know if you have any different problems using business objects.
Thank you.
If you register new Business Object and there is already one, the new business object will be created. Now we have added a new option:
Code: Select all
StiOptions.Dictionary.ReplaceExistingDataAtRegistrationOfNewData
You don't have to clear dictionary and synchronize business objects now.
Let us know if you have any different problems using business objects.
Thank you.
-
- Posts: 32
- Joined: Tue Jul 03, 2012 2:16 pm
Re: SynchronizeBusinessObjects
Hello,
In which version is this implemented?
Thanks.
In which version is this implemented?
Thanks.
Re: SynchronizeBusinessObjects
Hello, Daniel.
This feature will be available in our next prerelease build from October 18.
Thank you.
This feature will be available in our next prerelease build from October 18.
Thank you.
-
- Posts: 32
- Joined: Tue Jul 03, 2012 2:16 pm
Re: SynchronizeBusinessObjects
Hello.
I downloaded the prerelease build, but I did not find this property.
Was It released? If not, when will it be?
Thanks.
I downloaded the prerelease build, but I did not find this property.
Was It released? If not, when will it be?
Thanks.
Re: SynchronizeBusinessObjects
Hello.
Please, check the version of assemblies that you use.
The version of assemblies should be 2013.3.1701.
You should update assemblies in GAC.
You could read more in our Knowledge Base.
Thank you.
Please, check the version of assemblies that you use.
The version of assemblies should be 2013.3.1701.
You should update assemblies in GAC.
You could read more in our Knowledge Base.
Thank you.
-
- Posts: 32
- Joined: Tue Jul 03, 2012 2:16 pm
Re: SynchronizeBusinessObjects
Hello.
Yes, you are right.
Maybe I had some references problem, I don't know. But I found it now!
BUT, it still didn't work. Nothing has changed.
Debugging the code, I found out that the code of RegBussinessObject verify the property ReplaceExistingDataAtRegistrationOfNewData, and iterates the StiReport.BusinessObjectsStore property.
But when my code gets the report from the request:
This property comes empty, so it never runs the code of update the bussiness objects, and ends up always adding them.
Only property StiReport.Dictionary.BusinessObjects have data.
Is this right?
Thanks.
Yes, you are right.
Maybe I had some references problem, I don't know. But I found it now!
BUT, it still didn't work. Nothing has changed.
Debugging the code, I found out that the code of RegBussinessObject verify the property ReplaceExistingDataAtRegistrationOfNewData, and iterates the StiReport.BusinessObjectsStore property.
But when my code gets the report from the request:
Code: Select all
StiReport report = StiMvcDesigner.GetReportObject(this.Request);
Only property StiReport.Dictionary.BusinessObjects have data.
Is this right?
Thanks.
Re: SynchronizeBusinessObjects
Hello,
> This property comes empty, so it never runs the code of update the bussiness objects, and ends up always adding them.
> Only property StiReport.Dictionary.BusinessObjects have data.
> Is this right?
Yes.
Most probably we do not exactly understand your questions in first post.
Lets try answer again:
> So, I wanted to know two things:
> 1) Why SynchronizeBusinessObjects() are just adding new objects and properties, but not removing the old ones?
It's by design, only refresh and adding new.
It is possible to directly register new data during report execution. So there are cases when before running the report, not all data are registered, but corresponding business objects are needed.
Please clarify what goes wrong with old Business Objects.
> 2) What could I do to solve that?
For DataSources there is a report.Dictionary.RemoveUnusedDataSourcesV2() method.
We can try to add the similar method and for business objects.
Thank you.
> This property comes empty, so it never runs the code of update the bussiness objects, and ends up always adding them.
> Only property StiReport.Dictionary.BusinessObjects have data.
> Is this right?
Yes.
Most probably we do not exactly understand your questions in first post.
Lets try answer again:
> So, I wanted to know two things:
> 1) Why SynchronizeBusinessObjects() are just adding new objects and properties, but not removing the old ones?
It's by design, only refresh and adding new.
It is possible to directly register new data during report execution. So there are cases when before running the report, not all data are registered, but corresponding business objects are needed.
Please clarify what goes wrong with old Business Objects.
> 2) What could I do to solve that?
For DataSources there is a report.Dictionary.RemoveUnusedDataSourcesV2() method.
We can try to add the similar method and for business objects.
Thank you.
-
- Posts: 32
- Joined: Tue Jul 03, 2012 2:16 pm
Re: SynchronizeBusinessObjects
Hello.
Maybe I did not undestand your answer. I will explain better what is the problem.
Given my bussiness object:
When the report designer is called, this code register the bussiness objects for it to use:
But, if my object changes:
In the dictionary of the Report Designer (while editing the report created previously), I will see the following:
But the Age property does not exist anymore.
So, what I need, is to know what can I do to remove this property from the dictionary of old reports.
Thanks.
Maybe I did not undestand your answer. I will explain better what is the problem.
Given my bussiness object:
Code: Select all
public class Person
{
public int Id;
public string Name;
public int Age;
}
Code: Select all
myReport.RegBusinessObject(dataSourceName, new List<Person>());
myReport.Dictionary.SynchronizeBusinessObjects(50);
myReport.Dictionary.BusinessObjects.Sort(StiSortOrder.Asc, true);
Code: Select all
public class Person
{
public int Id;
public string Name;
public DateTime BirthDate;
}
Code: Select all
Person
{
Age
BirthDate
Id
Name
}
So, what I need, is to know what can I do to remove this property from the dictionary of old reports.
Thanks.