1 Reply Latest reply on Jan 19, 2018 11:18 AM by mnudel RSS
    mnudel Apprentice

    What is the quickest way to find the earliest timestamp in the value stream?

    Hi there,

     

    I'd like to know what is the best way to find the earliest (first) timestamp in the value stream. Code below does work, but it takes a long time if there are few propertyNames. It necessary to know at what point data became available. I'd be grateful for your advise, thanks!

     

    var endDate = new Date();
    var startDate = new Date();
    startDate.setYear(2000);
            
        var params = {
            oldestFirst: true /* BOOLEAN */,
            maxItems: maxitems /* NUMBER */,
            endDate: endDate /* DATETIME */,
            propertyNames: propertyNames /* INFOTABLE */,
            query: undefined /* QUERY */,
            startDate: startDate /* DATETIME */
        };
    
        // result: INFOTABLE dataShape: "undefined"
        var myQuery = Things[thing].QueryNamedPropertyHistory(params);
        var result = myQuery.rows[0].timestamp;     //DATETIME