LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Show Events in Log Buffer String with Timestamp

Solved!
Go to solution

Hello Everyone,

 

I want to display Events in my Log Buffer String apart from the data. For Example, I want to show:

1) If the connection is established with the port, it should display CONNECTION ESTABLISHED with a timestamp.

2) Change of Event Should be displayed as well.

3) If any Error occurred, display ERROR OCCURED and so on.

 

I have attached the image of my front panel for reference. Please do help me in case anyone has any ideas on how it can be done. 

 

Vielen Danke!

0 Kudos
Message 1 of 9
(2,504 Views)

Would really appreciate if someone can at least give some clue on how to proceed at it.

0 Kudos
Message 2 of 9
(2,404 Views)

Without seeing your code there is not much we can tell you besides update your indicator/log string as necessary.

 

I did something similar in my last application. The underlying architecture is a State Machine and I log/display with a timestamp every state as that state is entered.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 9
(2,380 Views)

Hello,

 

I am able to solve the majority of the issue, but when I save my data to a text file I need to give a Timestamp for every value, and when I do that in a text file I am getting values like 3723091663.334 instead of Date and Time.

 

Could anyone please help me with this issue?

0 Kudos
Message 4 of 9
(2,323 Views)

If you plug that number into the Seconds to Date/Time function you will see the  actual time stamp. The number 3723091663.344 is the number of seconds since LabVIEWs' epoch. 

Second to date time.png

Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 5 of 9
(2,318 Views)

@GovBob wrote:

If you plug that number into the Seconds to Date/Time function you will see the  actual time stamp. The number 3723091663.344 is the number of seconds since LabVIEWs' epoch. 

Second to date time.png


"To Time Stamp" does this too

totimestamp.png

 

Excel and most popular spreadsheet programs understand the raw (floating point) timestamp. 

 

You can change the format in Excel pretty easy

  1. Highlight the column
  2. Right click on the highlighted column
  3. Select "Format Cells" from the pop-up menu
  4. Select "Time" or "Date" in Format Cells menu
  5. Select the Time/date format you want.
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 9
(2,309 Views)
Solution
Accepted by topic author ChikuSK

@ChikuSK wrote:

Hello,

 

I am able to solve the majority of the issue, but when I save my data to a text file I need to give a Timestamp for every value, and when I do that in a text file I am getting values like 3723091663.334 instead of Date and Time.

 

Could anyone please help me with this issue?


That is the underlying value of the timestamp. Others have shown you how to convert back to a timestamp, but assuming you want your text file to be human readable without being read back into another program, use either Get Date/Time String or Format Date/Time String to convert from a timestamp to a string.

 

For example:

 

FormatDateTimeString.png

0 Kudos
Message 7 of 9
(2,289 Views)

Hi, Thank you. It worked to show on the front panel but I am not able to convert it to a array to give to build array function. As rest of the values writing to text file are in array. 

 

Can you please tell me how can I convert this timestamp string to array so that i can give it to build array function

 

Thanks

0 Kudos
Message 8 of 9
(2,233 Views)

@ChikuSK wrote:

Hi, Thank you. It worked to show on the front panel but I am not able to convert it to a array to give to build array function. As rest of the values writing to text file are in array. 

 

Can you please tell me how can I convert this timestamp string to array so that i can give it to build array function

 

Thanks


It would be helpful if you could share some example code that explains what you are trying to do. I'm afraid I don't quite understand the question.

 

The rest of the values are in an array of what type?

 

Simply running to a build array function will convert the string into an array of string with one entry. You can build an array of strings just as any other data type.

 

If you have a numeric array, it's (slightly) more complicated. You can't just add a string to a numeric array.

0 Kudos
Message 9 of 9
(2,209 Views)