[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 424
  • Last Modified:

DB Chart Axis Components from ADO

Hi all,

I found an article on about.com that helped me figure out how to set the series to a field that does not appear in the code - however, they have a line of code that I do not understand and cannot figure out the equivalent in my app:

with DBChart1.SeriesList.Series[0] do begin
 DataSource := ADOQuery1;
 XLabelsSource := ADOQuery1Company.FieldName;
 XValues.ValueSource := ADOQuery1SumItems.FieldName;
 YValues.ValueSource := '';
 Marks.Style := smsXValue;
 CheckDataSource;


My Query is ADOQuerySalesman and my field is u_name
It does not have full source, so I am not sure what ADOQuery1Company.FieldName is supposed to represent.  I tried using ADOQuerySalesman.u_name, I tried using ADOQuerySalesmanu_name.Fieldname - I'm not sure what that line represents - can anyone help?  Either with this specifically - or any help with DBChart and how to set it up via code

Thanks all!
0
Chipmunk77
Asked:
Chipmunk77
  • 2
1 Solution
 
calinutzCommented:
ADOQuery1Company is the name of the field assigned by delphi when you access the ADOQuery in the Object Treeview and on right click select Add all fields.
When you do that all the fields returned by your query (written in design time) will appear there in a fieldname, that usually looks like this:
queryfieldname1, queryfieldname2... and so on... depending on what fields you return with your query.


So a short example:
Query name='myquery'
Query= 'select name, address, date, day from table1'
// now when you go to Object treeview and right click on your query component, choose Add All Fields, and your automatic fields will appear bellow in the treeview as follows:
myqueryname,myqueryaddress,myquerydate,myqueryday

Do you understand now?

0
 
calinutzCommented:
Instead of using the exact demo of the tutorial you could use an alternative to that assignment such as:


with DBChart1.SeriesList.Series[0] do begin
 DataSource := ADOQuery1;
 XLabelsSource :=ADOQuery1.Fields[0].DisplayName;
 XValues.ValueSource := ADOQuery1.Fields[1].DisplayName;
 YValues.ValueSource := '';
 Marks.Style := smsXValue;
 CheckDataSource;



It should work
0
 
Chipmunk77Author Commented:
Thanks!  I understand now, that will be very helpful!  :-)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now