YamidP

X-Axis Error datetime

Recommended Posts

Good night, everyone

 I'm currently working on a project where I want to graph data vs time (2D graph). The data (Y axis) and time (X axis) is collected through SQL queries. The time data in the database is of datetime type, however, DAQFactory shows it in other values (see image )

What should I do to have the same type of data in DAQFactory?

what kind of time data does daqfactory support?

thank you

 

image.png

Share this post


Link to post
Share on other sites

DAQFactory wants time in UNIX time, which is seconds since 1970.  Today's date is a little more than 1.5 billion, and from the look of it, Time.DateAndTime are already in this format.  So, you just need to combine Millitm and DateAndTIme (by dividing Millitm by 1000 and adding to DateAndTime).  Then you can use the result as the X axis expression for the trend graph, or alternatively, stick the time stamp into the time portion of the main variable.  So, if you have:

myVariable = // some data from the database
DateAndTime = // time stamps in proper form from somewhere

myVariable.time = DateAndTIme  // assigns time stamps to time portion of myVariable

Once you've done that, then the X expression can just be "Time" as default.

Be careful with your queries though.  You make two queries to the same database, with one being sorted and the other not.  That means the results won't line up.  You should instead consider just doing one query and getting all the data as one.

Share this post


Link to post
Share on other sites

 

Hello, Guru, I got it right. The data sets are:

 Y-axis = test.Milltm   

determined by the following consultation

global test = db.QueryToClass(dbase, "SELECT Millitm FROM [Tecnofar_CIP]. [dbo]. [FloatTable_CIP_Globales] ORDER BY DateAndTime asc")

X-axis = test.Time or "Time   

the image shows the configuration. is this configuration correct?

2D.JPG

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now