Issue Inserting Time to Variable

Recommended Posts


I was trying to use insertime() to change the time associated to a variable but that didn't work. 

Here is what I am trying to do:

A barcode scanner is used to assign value to a variable strTemp. The time when scanning happened is then attached to that variable. I tried to change that time to a current system time by using inserttime() then assign strTemp to a virtual channel. But the time always remains the same, whether the time is inserted to strTemp or the channel. I tried different ways attempting to "detach" the time but seems like it will always be there unless a complete new value is assigned to it, such as strTemp = "xx". But I need the original value from the barcode scanner.

I'd appreciate if you could provide some guidance on this.


Link to comment
Share on other sites

insertTime() doesn't affect the variable inside the (), but instead returns a result with the time changed.  So:

InsertTime(strTemp, systime(),0)

won't do anything, but:

strTemp = insertTime(strTemp,systime(),0)

will do what you want.

Note this doesn't work for channels, V or otherwise because they don't act completely like variables.  For channels you have to make sure the time stamp is correct before the value ends up in the channel.


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.