X-Axis Error datetime


YamidP

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

Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.