osmansirmali Posted August 4, 2008 Share Posted August 4, 2008 Hi We want to bring to x and y axis from SQL database instead of Time Axis. Please see our attached file ("Sample.CTL"). and than Could you please send me your answers by forum messages. Best Regards Sample.ctl Link to comment Share on other sites More sharing options...
AzeoTech Posted August 5, 2008 Share Posted August 5, 2008 Its a little unclear exactly what you are doing in your file, but I think I know what you are trying to do. The easiest way to import a bunch of data from a database is actually to use a rather undocumented function called QuerytoClass(). Its been in DAQFactory for quite awhile and used by quite a few apps, so is well tested, and very fast in comparison to the old Query() function. QuerytoClass() will do a query and put the entire result set into a class with one call. A class is another undocumented feature I'm afraid, but for your purpose you can think of it as a structure. Basically you do something like this: private handle = db.Open("SEMlog") global datain = db.QueryToClass(handle,"select zaman, ("+yeksen+") from Table_1 where zaman between ("+start_date+")and("+end_date+")") db.Close(handle) you might want a try/catch block too, but I'll ignore that for now. The QueryToClass function will make datain into an instance of a class that contains a member variable for each field in the query (i.e. "zaman" and whatever "yeksen" lists. It also creates two additional member variables called FieldNames, which is an array of strings listing each of the fields, and RecordCount which is the number of records returned. RecordCount is a bit redundant, because you could just do NumRows(datain.Zaman) to get the same thing. To access each field, just list the variable name (datain), a period, and the field name: datain.Zaman If these are globals you could then plot them as such. I would expect that these two things (QueryToClass and classes) will be documented in an upcoming release. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.