Flattening LV Timestamp to String

Hardware:
 cRIO 9004 with 9103 FPGA.
I am running your standard Low-Priority, High-Priority / Host PC
split-architecture to acquire data via my 9004/9103 and sending that
data via TCP/IP to my host computer.
I want to send a unique timestamp generated in the High Priority loop
with my FPGA data over the TCP/IP , but need some advice on how to
break it up and append it to my flattened string.  The reason I
want to do this is that I want to generate a waveform from my data when
it gets back to my host PC.  The data is in an array from my FPGA
call.
I can cobble something together, but am wondering whether someone
cleverer than I has run into this and has some advice / sample code.
Thanks!!
Wes
Wes Ramm, Cyth UK
CLD, CPLI

Hi Wes:
If I understand correctly, all you are trying to do is to essentially transport a waveform from your RT system to your Host?
If so you can simply take the data point and the time stamp and use the Build Waveform function on your host side.
Best Regards,
Jaideep

Similar Messages

  • Formatting a timestamp into string with $ specifier

    Formatting a timestamp into string with $ specifier does not work; the formatted string is empty and no error is reported:
    I have forced the width to 10 to show that the format is at least partially scanned but when it is omitted the timestamp field is empty.
    I couldn't find this problem reported/addressed so here it is (LabVIEW 8.6)
    LabVIEW, C'est LabVIEW

    Yes, the simple work around is to put the timestamp first in both the string and the inputs.  But this is a bug.  There is no doubt about that.  A high priority?  Probably not.  Something that should be looked for when doing a revamp of the Format String?  Yep.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Convert timestamp to string with milliseconds showing.

    I have two questions. The first is I need to know how to convert the timestamp that displays from "Get Date/Time in seconds" to a string format.  I found the vi that converts to string but it stops at seconds and cuts off the milliseconds. I wired true to the "Get seconds" terminal so I get the time in seconds, I just don't get the millisecond value. Also I need to know if the clock from "Get Date/Time in seconds", is synchronized (or shows the same time down to the millisecond) with the timestamp that shows in the CAN read vi. I need to have the clock/timestamp from the CAN read synchronized with the "Get Date/Time in seconds" clock/timestamp. I am trying to compare delays in the CAN so I need precision down to the millisecond.

    Use Format Date/Time String.  For the format code use %H%M%S%4u to get two digits for hours, two digits for minutes, two digits for seconds, then a decimal, and after the decimal you get 4 digits for fractions of a second.  Replace the 4 with a 3 to get milliseconds, or with a 1 to get tenths of a second.   You get the idea...  See attached vi.
    - tbob
    Inventor of the WORM Global
    Attachments:
    Milliseconds.vi ‏12 KB

  • Calculate with timestamps in string format

    Hi,
    i have the following string as valid timestamp: "22.06.2005 17:47:55,16"
    Is there any statement/expression in TestStand available to transform this string into a
    valid number of seconds, because i want to calculate the difference between too
    values of this type.
    Regards,
    Sunny

    Sunny -
    TestStand does not have any expression functions to do this. You will have to either write a complex expression to attempt to determine the number of seconds, or use a code module to do the conversion.
    It appears that your date format can be parsed easily. Here is a starter expression that calculates the seconds since the start of 2005. I have not validated the leap year part but I think that I have accounted for it properly...
    'Assume date is stored in Locals.Date like this 22.06.2005 17:47:55,16
    'Year = Mid(Locals.Date, 6, 4)
    'Month = Mid(Locals.Date, 3, 2)
    'Day = Mid(Locals.Date, 0, 2)
    'Hour = Mid(Locals.Date, 11, 2)
    'Minutes = Mid(Locals.Date, 14, 2)
    'Seconds = Mid(Locals.Date, 17, 2) + Mid(Locals.Date, 20, 2)/100
    Locals.Seconds =
    'Years since 2005 minus 1 day per leap year
    ((((Val(Mid(Locals.Date, 6, 4)) - 2005) * 365 )
    - Round((Val(Mid(Locals.Date, 6, 4)) - 2005)/4))
    * 24 * 60 * 60)
    'Months minus 1 day if after February in leap year
    + ((({0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}[Val(Mid(Locals.Date, 3, 2))] )
    - Val( ( Val(Mid(Locals.Date, 3, 2))>2) && (((Val(Mid(Locals.Date, 6, 4)) - 2005)%4)==3) ))
    * 24 * 60 * 60)
    'Days
    + ((Val(Mid(Locals.Date, 0, 2))-1) * 24 * 60 * 60)
    'Hours
    + (Val(Mid(Locals.Date, 11, 2)) * 60 * 60)
    'Minutes
    + (Val(Mid(Locals.Date, 14, 2)) * 60)
    ' Seconds
    + (Val(Mid(Locals.Date, 17, 2)) + Val(Mid(Locals.Date, 20, 2))/100)
    Scott Richardson
    National Instruments

  • Incorrect timestamp to string conversions?

    Why does this code give different times when the UTC format? input changes?  The FieldPoint controller
    timezone is set to UTC and compensate for DST is disabled.  I would expect the two conversions to give the
    same result in this case but they don't.  RT 8.5.1.  The timestamps of readings in MAX are correct and the
    string formatted with UTC format? True is correct.
    Thanks.
    Matt
    Attachments:
    utc_time.vi ‏8 KB

    We're still seeing this in LabVIEW 2012.
    But it only appears to affect dates in BST, as soon as you get back into GMT this '-1' day error goes away
    Attachments:
    test - BST - UTC format bug.vi ‏16 KB

  • Conver Timestamp to String

    I Have
    Timestamp myTimestamp = new Timestamp(Calendar.getInstance().getTimeInMillis());
    I want to change it from string and save it to db and the db type is ADD Saving_Date TIMESTAMP NULL;
    Thank you
    I just simple change the column type to string then
    S_time = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(myTimestamp);
    Edited by: Hjava on Apr 10, 2012 3:15 AM
    Why? enhance some old style code, and they using string array to carry the insert action
    Edited by: Hjava on Apr 10, 2012 8:39 AM

    I Have
    Timestamp myTimestamp = new Timestamp(Calendar.getInstance().getTimeInMillis());So you have a Timestamp.
    I want to change it from stringBut it isn't a String. It is a Timestamp.
    and save it to db and the db type is ADD Saving_Date TIMESTAMP NULL;So do that. It's already in the correct format.
    EDIT:
    I just simple change the column type to stringWhy? You already had the correct Java datatype and the correct SQL column type. Now you've lost both, and you've also lost all the Java and SQL semantics that go with them both. You've done exactly the wrong thing here.
    Edited by: EJP on 10/04/2012 20:21

  • TimeStamp to String

    Iam using the DB2 data base and from my java program iam calling a db2 procedure. the procedure returns me a String in this format - 2004-06-22 20:21:12.777343. this is a timeStamp in DB2 , but in java iam getting it as a string using rs.getString metjod.
    I need to format this string as follows...
    2004/06/22 22:20
    How can i do this.....
    can any one help me in this matter
    Thanks

    You will want to take a look at the java.text.SimpleDateFormat
    In fact, it would be probably easier if you retrieved it from the database as a timestamp, and then formatted it.
    Timestamp ts = resultSet.getTimestamp("...");
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm");
    String formattedDate = sdf.format(ts);

  • Extract min timestamp from string

    Hello all,
    I am trying to query the minimum datetime from a column that is stored as nvarchar(max). There a a few tricky things with this query (at least for me)
    - There is more than just the date being stored within each record. 
    -The position of the datetime is relative- although it does always appear in the format '**(DD-MM-YY at HH:MM PM' 
    -There are multiple datetimes stored in each record-so not only do I need to locate and capture where there is a datetime, I need to find the minimum datetime within the record
    - I can't just change the format that the data is stored in- there is over a decade of information that is stored this way.
    Please Help
    The column is called 'hdresp'
    Here is sample data:
    **(03-Apr-14 at 09:44 AM email sent) -- Billy Bob:  Upgrade ordered.    **(02-Apr-14 at 04:16 PM email sent) -- Sammy Richards:  I can give you another cable to if you think that will help but it just might be time for an upgrade.  If
    you want to go that route I have to ask that you submit another request for New Hardware.    **(02-Apr-14 at 03:17 PM email sent) -- Paul Smith:  Michael  Stop by my desk when you have a second.
    -What i would like to end up with is a query that identifies '02-Apr-14 at 3:17 PM' as the minimum time and converts it to 'YYYY-MM-DD HH:MM:SS' -for example '2014-04-02 15:17:00' 
    Thanks!

    Thank you everyone for your help!
    I ended up using this to extract and convert the minimum time from a string:
    SELECT CONVERT(datetime, REPLACE(LEFT(RIGHT(hdresp, PATINDEX('%(**%', REVERSE(hdresp)) - 1), 21), 'at ', ''))
    from tblhdmain
    where hdindex = 211458
    Which gave me the result:
    2014-04-02 15:17:00.000

  • Enqueue flatten string vs cluster

    I have seen someone flatten a cluster into string and enqueue the string instead of enqueuing the cluster directly.  Is that a reason why he would do that?  It was code for LabVIEW 7.0.  Maybe a limitation in previous version of LabVIEW?  What is the pros and cons of doing that?
    Kudos and Accepted as Solution are welcome!

    Unless you need to pass the data to something other than a LabVIEW application there is no real benefit to flattening the cluster to a string.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Bug with Base LVOOP object variants and flatten string.

    I found a bug when if the base LabVIEW Object is wrapped in a variant (even indirectly), it cannot sucessfully be flattened to and from a string.
    Neither of these should produce an error.
    And if you try to work around it with XML, it can lockup or crash.

    The first is the simplest demonstration of the problem.
    The second is to show that problem is indirect (through multiply layers of different structures).
    As for the purpose I was writing a SQLite interface that could write any form of LabVIEW data while maintaining variant attributes. I have to serialize the data somehow so the first attempt I just packed it into a variant then turned that into a string with flatten to string (since the variant contains the type info for what it holds I just need to use the type info for a variant to unserialize it). That failed with the first bug if I tried to store a variant with a attribute holding something down classed to the LabVIEW base object.
    So instead of wrapping it in a variant I tried directly flattening it to a string and storing the type info from variant to flatten as a pascal string at the front of serialized data (of course this breaks if a LabVIEW object two variant levels deep is passed in). But that destroys variant attributes. So I tried wrapping that in a cluster then flattening the cluster (hence error two, and since it's indirect I can't wrap it in anything to avoid the problem).
    So the current work around is to never store anything in the LabVIEW base object. So If I wanted a generic LVOOP container I would have to make a class for storable items then everything that can be stored would have to inherit from that.
    I'm mainly posting since unknown bugs are rarely fixed, and this one is a bit obscure.

  • Timestamp method fromText, format string for timezone

    Hi,
    I try to import a time string as follow:
    Timestamp timestamp;
    std::string timetext = "2005-06-17T13:16:46.000+02:00";
    timestamp.fromText(timetext, "YYYY-MM-DD\"T\"HH24:MI:SS.FF[tzh:tzm]", "", environment);
    I write this timestamp to the database and see at the database the wrong date 2005-06-17T13:16:46.000 and not 2005-06-17T15:16:46.000.
    I got this string with different timezone (e.g. +02:00, +03:00, -01:00).
    I want only UTC time (+/-0, timestamp without any timezone) at the database.
    Greetings
    P

    You can use 'at time zone' in your insert statement to normalize to UTC. This assumes that the timestamp datatype in the table is 'timestamp' and not 'timestamp with time zone'. If the datatype is the latter then you should not use the 'at time zone' because timezone info is preserved and it is just a matter of displaying it in whatever timezone you choose.
    For example:
    create table tstest (ts timestamp, tstz timestamp with time zone);
    insert into tstest values (systimestamp at time zone 'UTC', systimestamp);
    alter session set nls_timestamp_format='yyyy-mm-dd hh24:mi:ss';
    alter session set nls_timestamp_tz_format='yyyy-mm-dd hh24:mi:ss,tzh';
    select ts, tstz at time zone 'UTC', tstz at time zone 'America/Los_Angeles' from tstest;

  • Unflatten data using only the output from flatten to string

    Using the Unflatten from String vi requires that you provide the type. This is not always possible - you may not know it (or you have a number to choose from). In a situation where the original data is flattened, then the Type String & Data string are clustered & flattened again, you have a common structure no matter what the source data. Unflattening will return the Type & Data strings of the original data, however I have seen no vi anywhere that either converts Type String to Type, or Unflattens data given only the Type & Data strings. How is either of these done?
    Attachments:
    Type_conversion.vi ‏48 KB

    You are asking too much from LabVIEW or any compiler for that matter. When the the datatype is unknown or undefined at compile time, it can't change the code to adapt to the incoming data. That is the programmer's job to do this and provide code to detect the incoming datatype and branch to appropriate routine to handle each datatype after it has been cast to a known type.
    The compiler has to know the datatype before generating the code. Can you imagine executing your diagram in debug mode and see the wire change type from one iteration to the other as the incoming data changes type? That's the programmer that knows what datatypes are to be expected.
    The original poster suggested to bundle typestring and flat data: you essentialy have
    a structure similar to a variant. If you want to use undefined datatype, you should use variants instead of flattened strings since it includes the datatype. See my presentation on OpenG.org http://openg.org/tiki/tiki-index.php?page=2003-05-06+Group+Meeting
    to see how to manipulate variant data at run-time.
    LabVIEW, C'est LabVIEW

  • How can I get a variant's string data?

    Greetings!
    When I view a variant indicator, I see a (generally) human-readable block of text.  This makes sense to me, since, as I understand it, a variant is, internally, a kind of flattened string.  My question is:  is there a way that I can get that string in LabVIEW, and can I then load that string back into a variant?
    I'm trying to preserve the human-readable aspect of the variant data.  Flatten to/Unflatten from String is not human readable, and the variant versions of Flatten/Unflatten drop the variant's attributes.  I've also tried Flatten to/Unflatten from XML, which drops the attributes AND does not unflatten correctly.
    Any help you can offer would be appreciated.
    Thanks!
    Allen C. Smith
    Ktech Corporation

    I think Allen wants to have access to the plain string that is displayed in the variant container and I have not found a way to get it. The method should require no code and should be independent on the complexity of the data contained in the variant.
    I agree this could be somewhat useful and should be supported. For example, we could have a readable property for the variant indicator similar to the text.text property of string indicators.
    The text.text string property gives the text formatted as shown in the indicator and thus depends on the display style (normal, '\'-codes, password, hex). It can be e.g. used to convert a plain string to a plain string that incorporates '\'-codes that is available to the code. (See image). This could be useful in a case where you want to mix '\'-codes and plain codes in a descriptive display, for example containing the following three lines:
    "The received string in '\'-codes is:
    ABC\tDEF\tGHI\n
    please verify there are no unexpected characters"
    Message Edited by altenbach on 01-17-2007 09:40 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    StringDisplay.png ‏10 KB

  • How to parse the date value for the string 2003-04-25 11:53:11 IST

    This is my database output for the date value(2003-04-25 11:53:11 IST). How to convet this string to Timestamp date value. Any one pl. help me

    BUT ... there is a public static Timestamp valueOf(String s) method in the Timestamp class that might help.
    http://java.sun.com/j2se/1.4.1/docs/api/java/sql/Timestamp.html#valueOf(java.lang.String)

  • Timestamp error in j2se5.0

    I am working on opensource project and i am buiding it from source.
    it will work on jdk1.5 and orackle 10g, when i am buindling, i am getting error of timestamp as:
    "reference to Timestamp is ambiguous, both class java.sql.Timestamp in java.sql a
    nd class java.security.Timestamp in java.security match
    [javac] Timestamp ConvDate, String RateType, int AD_Client_ID, i
    nt AD_Org_ID)"
    first I tried with jdk5.0 as in the sun site in compatbility it is given timestamp function is removedin jdk5.0, and j2se5.0 i shaving that function.so I tried with it but I am getting the same error.
    How can I include Timestamp function in j2se, so that i can over come this problem.plz help me out.

    This has nothgin to do with Java 1.5 and not with Timestamp and not with compatibility and not with any removal. This is simple namespace behaviour in your source code. You have a class that imports java.sql.Timestamp and java.security.Timestamp (e.g. if you do a import java.security.*). If you now use the class Timestamp how should Java know which one to use? You need to use it with full package reference in your method where you use it:
    java.sql.Timestamp ts = new java.sql.Timestamp(System.currentMillis());Perhaps you don't need java.security.Timestamp but other classes from java.security. So don't import the whole package (import java.security.*) but onle the classes you really need. Then you can use Timestamp without the package reference in your method.

Maybe you are looking for