Business objects data source

Stimulsoft Reports.NET discussion
Post Reply
cassio
Posts: 2
Joined: Tue Dec 26, 2006 7:59 am
Location: Brazil

Business objects data source

Post by cassio »

Hi. I'm trying to use my business objects as data source of my reports but I can't make it work with generic List or IList.
The lists are represented by simple properties but I want to see the properties of the objects inside the lists.

short example:

Code: Select all

public class Client
{
private long id;
private string name;
private ClientContract contract;

public long Id
{
get{return id;}
set{id = value;}
}

public string Name
{
get{return name;}
set{name = value;}
}

public ClientContract Contract
{
get{return contract;}
set{contract = value;}
}
}

public class ClientContract
{
private long id;
private long number;
private List conditions;

public long Id
{
get{return id;}
set{id = value;}
}

public long Number
{
get{return number;}
set{number = value;}
}

public List Conditions
{
get{return conditions;}
set{conditions = value;}
}

}

public class PaymentConditions
{
private long id;
private DateTime creationDate;
private List papers;

public long Id
{
get{return id;}
set{id = value;}
}

public DateTime CreationDate
{
get{return creationDate;}
set{creationDate = value;}
}

public List Papers
{
get{return papers;}
set{papers = value;}
}

}

public class PaperType
{
....
}

...
...
...

//design report
...
report.RegData(new Client());
report.Design();

So, as you can see I have basic properties, lists of lists and so on. I'm using the latest demo version that I found of StimulReport.

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

Business objects data source

Post by Vital »

Because Conditions placed on second entry level you need use following code:

Code: Select all

            Client client = new Client();
            report.RegData("Client", client);
            report.RegData("Conditions", client.Contract.Conditions);
Thank you.
cassio
Posts: 2
Joined: Tue Dec 26, 2006 7:59 am
Location: Brazil

Business objects data source

Post by cassio »

Hi Vital. Thank you.

Now I have another problem. Sometimes it doesn't recognize my generic lists. To be more precise, the error occurs with generic lists of generic lists, and it's not a good option do RegData("MySecondList", MyList) for each element of the first list.

It truncates the a generic list declaration with this: System.Collections.Generic.List`1

I've noticed that it happens to any generic type.

The error message is: " error CS1056: Unexpected character '`' "

I'm testing with the release SR_2006.12.21_D2005.

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

Business objects data source

Post by Vital »

Please send source code of your business object (which generate this problem) to support [at] stimulsoft [dot] com.

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

Business objects data source

Post by Edward »

Please check the latest build from the January 15.

Thank you.
ChristianMyksvoll
Posts: 18
Joined: Thu Sep 22, 2011 8:42 am
Location: Norway

Re: Business objects data source

Post by ChristianMyksvoll »

Hi.
It seems like this issue has reappeared after several years... After I updated to the 2012.3 version, I get several error messages like this when trying to render one of my reports:

C:\Users\xxxxxx\AppData\Local\Temp\dne50iey.0.cs(1691,165) : error CS1056: Unexpected character '`'

This is the source of the error:

Code: Select all

<PersonerMedGodtgjorelse Ref="4" type="Stimulsoft.Report.Dictionary.StiBusinessObjectSource" isKey="true">
        <Alias>PersonerMedGodtgjorelse</Alias>
        <Columns isList="true" count="10">
          <value>Id,System.Int32</value>
          <value>Navn,System.String</value>
          <value>Adresse,System.String</value>
          <value>PostNr,System.String</value>
          <value>PostSted,System.String</value>
          <value>RollerIGrupper,System.Collections.Generic.IList`1[Acos.Møte.Application.Services.Rapporter.RapportMøteData]</value>
          <value>MøteDeltakelser,System.Collections.Generic.IList`1[Acos.Møte.Application.Services.Rapporter.RapportMøteData]</value>
          <value>MøteFravær,System.Collections.Generic.IList`1[Acos.Møte.Application.Services.Rapporter.RapportMøteData]</value>
          <value>_ID,System.Int32</value>
          <value>_Current,System.Object</value>
        </Columns>
        <Dictionary isRef="1" />
        <Name>PersonerMedGodtgjorelse</Name>
        <NameInSource>PersonerMedGodtgjorelse</NameInSource>
</PersonerMedGodtgjorelse>
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Business objects data source

Post by HighAley »

Hello.

This issue was fixed but if you use old reports then you should to Synchronize you Dictionary.

Thank you.
Post Reply