LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compare table data with current time and use its corresponding row value

Hello,

 

I have a table with 3 columns. one of the column contains time stamp at specific intervals (eg 2 min intervals). this is constanly updated table from a database using SQL. the other column has values corresponding to that timestamp.

The problem is :

I want to compare the current time with the table and use the corresponding value if the time stamp matches. If it does not match, I want it to run continuously and wait until the timestamp matches and then take the value. This value will be used to execute othe fuctions. I do not know how to compare it and how to make it run continuously in a while loop making it wait for each time stamp and take the value.

 

I am beginner to Labview and so I am finding it hard to solve it.

 

Kindly help me solve this ASAP.

 

Thanks in advance.

 

 

0 Kudos
Message 1 of 7
(3,043 Views)

one of the column contains time stamp

 

You'll need to convert this into LabVIEW TimeStamp values.  There is a scan from string option to do this, or you might be able to format a READ SPREADSHEET STRING operation to handle it.

 

In any case, if you have the table value in a TimeStamp variable, you can compare it directly to the current time.  You probably should NOT check for equality, since a TimeStamp value has microsecond resolution, the chances of a match are slim.  But you can subtrtact the two TimeStamps and see if the result is < +/- 1 sec, for example.

 

I am beginner to Labview and so I am finding it hard to solve it.

 

The best thing you can do is to break your problem down into simple operations.

I find it helpful to write them down, in pseudo-code:

 

LineFromSQL = Get line from database

TimeFromSQL = Extract time from LineFromSQL

TableTime = Convert to TimeStamp (TimeFromSQL)

Ready = FALSE

repeat

   If NOW >= TableTime

        Ready = TRUE

   else

        Wait (1000 mSec)

until Ready

Extract Other Data from LineFromSQL

Do other Functions (Other Data)

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 7
(3,031 Views)

Kindly show us the code you have developed.  Be sure to post code (we hate pictures of code, which are hard to execute unless you post them as Snippets).

 

Bob Schor

0 Kudos
Message 3 of 7
(2,999 Views)

Hi Bob,

 

I have attached the code. But it is only a code which gets the table from SQL. I think you need to create a similar DB inorder to run the Program.

 

I am also attaching pictures just for reference or to make the code more clear. Please bear with me.

 

 

I want ot use the value of the corresponding timestamp after comparing with the current time. This should happen every 2 minutes as per the present program. I will change it to 15 minutes after the proper solution is found.

 

Thank you very much for the help

Download All
0 Kudos
Message 4 of 7
(2,988 Views)

The code you posted has nothing to do with the question you asked.

 

Do you have any code pertaining to the time-matching question?

 

Or are you hoping someone else will do it for you?

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 7
(2,971 Views)

Like i told .. I only have a table and I dont know the way to solve it then after. 

 

 

I am not hoping for someone to do it rather hoping someone can show the way to do it, in a way I can understand as a beginner.

 

 

 

0 Kudos
Message 6 of 7
(2,963 Views)

Did you attempt to break it down into words, as I suggested above?

 

It might not work for everybody, but it works for me.

 

The actual writing (typing) of it forces me to think about the steps needed.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 7 of 7
(2,951 Views)