XtraReports Users Help - Binding Issue

Posts   
 
    
taylor74
User
Posts: 59
Joined: 06-Oct-2004
# Posted on: 31-Aug-2005 16:36:48   

I'm evaluating DevExpress XtraReports and I've come across something that doesn't make any sense. At runtime I fill a typedlist with data, set the report's datasource to the typedlist, and establish the bindings to the xrlabels. When I preview the report, nothing shows up. I actually got it to work by creating a dataset and adding the typedlist to it. That's all I did and I didn't change anything else; not even the report's datasource.

Is that normal? It doesn't make sense to me why I'd have to add the typedlist to a dataset when you're only using one table and still binding to that table and not the dataset.

Jeff

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 01-Sep-2005 02:57:03   

Could you post some of the code so that we could take a closer look at what may be causing the problem?

taylor74
User
Posts: 59
Joined: 06-Oct-2004
# Posted on: 01-Sep-2005 14:37:43   

An update on this issue... I started evaluation XtraReports at version 1.8.5 just a couple of weeks ago and then they released 1.8.6. So, I uninstalled the older one and put the newer one on the computer. I remembered I had a different small test project that I had created using the older version, which worked. I haven't modified that project and it doesn't work, now, with the newer version of XtraReports. Also, I haven't updated LLBLGen Pro since I created that small test project. So, the only thing that changed was XtraReports.

With the small test project not working, now, it is clearly a problem with XtraReports. In that project all I did was create a report with an xrLabel in the detail band, dropped a typedlist on the designer, and bound the xrLabel. On a form I put a button I do the following: ' code not checked for syntax, but you get the idea. dim report as new XtraReport1 ' ** add these 2 lines and it works ** dim ds as new dataset ds.tables.add(report.mytypedlist) ' ** they were not needed with the older version of XtraReports report.mytypedlist.fill report.showpreview() Again, that all worked before I switched to the newer version of the evaluation.

taylor74
User
Posts: 59
Joined: 06-Oct-2004
# Posted on: 02-Sep-2005 23:01:54   

Yup, it was a bug and got a response from DevExpress today.

Thanks for the report. We've managed to reproduce the problem and have already fixed it. If possible, please wait for the next official update, which may be released in a week. If the problem is critical, we will can send you an intermediate version.

nopchan
User
Posts: 56
Joined: 30-Apr-2005
# Posted on: 05-Sep-2005 17:13:07   

help me for example Databinding with llblgen typedlists

I can binding with typedlists in GUI Controls but I can not see it work.

nopchan
User
Posts: 56
Joined: 30-Apr-2005
# Posted on: 05-Sep-2005 17:14:22   

public void dataload()

{

this.arrecListsTypedList1 = new DataModel.TypedListClasses.ArrecListsTypedList();

IPredicateExpression A = new PredicateExpression();

A.Add(PredicateFactory.CompareValue(ArrecFieldIndex.ArrecNo, ComparisonOperator.NotEqual, " "));

RelationPredicateBucket ArrecFilter = new RelationPredicateBucket();

ArrecFilter.PredicateExpression.Add(A);

DataAccessAdapter adapter = new DataAccessAdapter();

adapter.FetchTypedList(arrecListsTypedList1.GetFieldsInfo(), arrecListsTypedList1, ArrecFilter);

this.DataSource = arrecListsTypedList1;

}


Ar.Reports.ReceiptLists Prevreport2;

Prevreport2 = new Ar.Reports.ReceiptLists();

Prevreport2.dataload();

Prevreport2.DataSource = Prevreport2.arrecListsTypedList1;

Prevreport2.ShowPreview();


I don't see any others that will work.

taylor74
User
Posts: 59
Joined: 06-Oct-2004
# Posted on: 05-Sep-2005 21:20:09   

Disclaimer: I haven't used Adapter that much and I use VB.NET, but can read most C# code. So, the code I insert below may not have correct syntax.

nopchan wrote:

public void dataload()

{

this.arrecListsTypedList1 = new DataModel.TypedListClasses.ArrecListsTypedList();

IPredicateExpression A = new PredicateExpression();

A.Add(PredicateFactory.CompareValue(ArrecFieldIndex.ArrecNo, ComparisonOperator.NotEqual, " "));

RelationPredicateBucket ArrecFilter = new RelationPredicateBucket();

I don't think you want to create a new bucket. You should grab the bucket from the typedlist using - (IRelationPredicateBucket)this.arrecListsTypedList1.GetRelationInfo

nopchan wrote:

ArrecFilter.PredicateExpression.Add(A);

DataAccessAdapter adapter = new DataAccessAdapter();

adapter.FetchTypedList(arrecListsTypedList1.GetFieldsInfo(), arrecListsTypedList1, ArrecFilter);

this.DataSource = arrecListsTypedList1;

}


Ar.Reports.ReceiptLists Prevreport2;

Prevreport2 = new Ar.Reports.ReceiptLists();

Prevreport2.dataload();

If you're using XtraReport 1.8.6, I found you have to create a DataSet and add the typedlist to it. DevExpress said they have fixed that and it isn't necessary any longer, but until the next release comes out I've done the following as a workaround.

DataSet ds = new DataSet; ds.Tables.Add(Prevreport2.arrecListsTypedList1);

nopchan wrote:

Prevreport2.DataSource = Prevreport2.arrecListsTypedList1;

Prevreport2.ShowPreview();


I don't see any others that will work.

Hope this helps.

nopchan
User
Posts: 56
Joined: 30-Apr-2005
# Posted on: 06-Sep-2005 10:34:11   

I add code

DataSet ds = new DataSet();

ds.Tables.Add(arrecListsTypedList1);

into reports file

then change code for fetchtypedlist


DataAccessAdapter adapter = new DataAccessAdapter(); adapter.FetchTypedList(arrecListsTypedList1.GetFieldsInfo(), arrecListsTypedList1, arrecListsTypedList1.GetRelationInfo());


but It not work

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 06-Sep-2005 10:36:21   

You specified a grid layout or something? (I'm not familiar with any devx grid) Did you specify columns or do you let the grid find out the columns?

Frans Bouma | Lead developer LLBLGen Pro
taylor74
User
Posts: 59
Joined: 06-Oct-2004
# Posted on: 06-Sep-2005 18:37:40   

Otis wrote:

You specified a grid layout or something? (I'm not familiar with any devx grid) Did you specify columns or do you let the grid find out the columns?

Otis, he's talking about their reporting component. From what I gather in a previous post, he bound the typedlist's fields at design-time, unless I'm mistaken.

nopchan, what exactly isn't working? Are you getting records in the typedlist? You might want to set a breakpoint after the fetch to verify that there is data in the list. Also, and this shouldn't really make a difference, but if you're setting the report's DataSource at design-time, then you don't need to do that at runtime unless you're using a different typedlist.

nopchan
User
Posts: 56
Joined: 30-Apr-2005
# Posted on: 07-Sep-2005 05:43:58   

I want binding direct to Typedlists (not dataset or data table) on design-time

set a breakpoint after the fetch to verify that there is data in the list is ok when I add code in before_print section

((XRLabel)xrTextNo).Text = String.Format("{0}",GetCurrentColumnValue("ArrecNo"));

data display correct. The report preview can display value of ArrecNo in filed of typedlists.

but I binding direct to typedlists on design-time can not work. this is report display "xrTextNo" in report preview .

nopchan
User
Posts: 56
Joined: 30-Apr-2005
# Posted on: 07-Sep-2005 07:01:05   

I add code after fetchtypedlists

        ds.Tables.Add(arreclsListsTypedList1);
        this.DataSource = ds;

and then add code in before_print section for binding record at runtime

    ((XRLabel)xrLabel1).Text = String.Format("{0}",GetCurrentColumnValue("ArtaxInvno").ToString().Trim());

report can work Ok

Xtra reports can not support llblgen Typedlists but support dataset or datatable

taylor74
User
Posts: 59
Joined: 06-Oct-2004
# Posted on: 07-Sep-2005 07:03:44   

nopchan wrote:

but I binding direct to typedlists on design-time can not work. this is report display "xrTextNo" in report preview .

Hmm. I'm not sure what the problem is at this point. I'm able at design-time to: 1) create new report, drop a typedlist on it, and set the report's DataSource to it. 2) drop a label in the detail section and bind to a field in the typedlist. Then, at runtime. 3) in the button click event on a form I do... Dim rpt as New XtraReport1 rpt.MyTypedList.Fill ' self-servicing code. rpt.ShowPreview()

This test code created when I was evaluating XtraReports worked for me in version 1.8.5, but stopped working when I moved to 1.8.6 and I starting getting what you said above. That's when I discovered I had to contain the typedlist inside a DataSet, until they get the fix out in the next release.

I'll take another look at your code, but I can't see why this problem won't go away for you if my DataSet workaround above didn't work.

taylor74
User
Posts: 59
Joined: 06-Oct-2004
# Posted on: 07-Sep-2005 07:10:22   

nopchan wrote:

I add code after fetchtypedlists

        ds.Tables.Add(arreclsListsTypedList1);
        this.DataSource = ds;

Hmm, same workaround that I use except I kept the DataSource set to the typedlist.

nopchan wrote:

Xtra reports can not support llblgen Typedlists but support dataset or datatable

Actually a typedlist is nothing more than a datatable. DevExpress has a fix for this bug of using a datatable / typedlist as a datasource.

nopchan
User
Posts: 56
Joined: 30-Apr-2005
# Posted on: 07-Sep-2005 12:35:01   

now I work ok on xtra reports 1.8.6 with dataset but not work on typedlists

I wait for devexpress upgrade to new version then test again.

Thank.