Can I pass a disconnected recordset to a crosstab source

TeeChart for ActiveX, COM and ASP
Post Reply
Carlos
Newbie
Newbie
Posts: 5
Joined: Mon Nov 22, 2004 5:00 am
Location: Mexico
Contact:

Can I pass a disconnected recordset to a crosstab source

Post by Carlos » Wed Sep 14, 2005 2:43 am

Hello,
I would like to pass a recordset to crosstab source object.
Something like:

set rs = new adodb.recordset
rs.fields.append("grp", ...)
rs.fields.append("lbl", ...)
rs.fields.append("val", ...)
for i = 0 to ...
rs.addnew
rs(0).value = g(i): rs(1).value = l(i): rs(2).value = v(i)
next i
rs.batchupdate
'crosstabsource.datasource = rs

is it possible?

Yours

Carlos

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Sep 14, 2005 11:30 am

Hola Carlos,

Yes, this is possible. For more information on how to use TeeChart with databases please read "Tutorial 8 - ADO Database access" and have a look at the features demo examples (All Features\Welcome!\Database Charts). You'll find the tutorials and features demo at the TeeChart program group.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Carlos
Newbie
Newbie
Posts: 5
Joined: Mon Nov 22, 2004 5:00 am
Location: Mexico
Contact:

Post by Carlos » Thu Sep 15, 2005 12:09 am

Hi Narcis,

Thansk for your reply, Unfortunately that's not what I want. I want to use the crosstab source object and not the ADODB support of the chart object.
The problem is that I don't know how many series and points I have beforehand.

Is it possible?

Thanks again

Carlos

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Sep 19, 2005 9:22 am

Hi Carlos,

you cannot pass a recordset directly to the CrosstabSource, that I know of. It can be only used as in the DB CrossTab source example, using similar code to the following :

Code: Select all

Private Sub Form_Load()
  With CrossTabSource1
    .DataSet = "DSN=TeeChart Pro Database; SQL=select * from orders"
    .Series = TChart1.Series(0)
    .GroupField = "Terms"
    .LabelField = "PaymType"
    .ValueField = "AmntPaid"
  End With
End Sub
But, you can always generate the recordset, iterate through it and then add data manually to the Chart Series using the AddXY method.

Post Reply