7 Replies Latest reply on Mar 13, 2017 5:55 AM by carlesc RSS
    aelgov Apprentice

    check if stream entry exist while inserting for the 2nd time



    I'm adding stream entries using this snippet:




    var params = {

      sourceType: undefined /* STRING */,

      values: values /* INFOTABLE*/,

      location: undefined /* LOCATION */,

      source: undefined /* STRING */,

    timestamp: myDate /* DATETIME */,

      tags: undefined /* TAGS */





    If I try to add the same row twice:



    It will not add the 2nd time - OK!

    I just want to know if this row already exist, I tried to add try and catch but there is no exception thrown.

    What is the BEST way to do that instead of checking with getStreamEntry as this will require to check for every entry that I try to add.

    *My key is the timestamp + another column (String) - I don't use the ms part of the time stamp, so if the entry is not exist but still have the same timestamp I will add 1 millisecond to the timestamp and insert it to the stream.

    Thanks in advance.