Skip to main content
April 21, 2017
Solved

Issue on stream (no value stream)

  • April 21, 2017
  • 3 replies
  • 2102 views

I All,

I created a new Stream 'TEST' form a DataShape like the following

I also created a service to store information in Stream by service AddStreamEntry().

With a service QueryStreamData() I saw all the rows stored into Stream.

I create a new service to get a subset of data from the stream using StartDate and EndDate but for both solution I didn't receceive return values.

FIRST TEST :

I set the date on the parameters like

var params = {

    oldestFirst: undefined /* BOOLEAN */,

    maxItems: undefined /* NUMBER */,

    sourceTags: undefined /* TAGS */,

    endDate: DateEnd /* DATETIME */,

    query: undefined /* QUERY */,

    source: undefined /* STRING */,

    startDate: DateStart /* DATETIME */,

    tags: undefined /* TAGS */

};

No output was  found, but there are into Stream  some data  between StartDate and EndDate.

SECOND TEST:

I creare a filter like

var date_start=DateStart.getTime();

var date_end=DateEnd.getTime();

my_query={

            "filters": {

                "type":"Between",

                "fieldName":"timestamp",

                "from": date_start,

                 "to":date_end

              }

         };

and put this into paramters like

var params = {

    oldestFirst: undefined /* BOOLEAN */,

    maxItems: undefined /* NUMBER */,

    sourceTags: undefined /* TAGS */,

    endDate: undefined /* DATETIME */,

    query: My_query /* QUERY */,

    source: undefined /* STRING */,

    startDate: undefined /* DATETIME */,

    tags: undefined /* TAGS */

};

Also in this case no output was found.

Please, anyone can give me some suggestions.

Many Thanks

BR

Dimitri

Best answer by ankigupta

Screenshot of result:

3 replies

5-Regular Member
April 21, 2017

Hi Dimitri Bologna​,

I just tested this scenario on ThingWorx version 7.4 and it works fine.

Here is my code:

var params = {

    oldestFirst: undefined /* BOOLEAN */,

    maxItems: undefined /* NUMBER */,

    sourceTags: undefined /* TAGS */,

    endDate: EndDate /* DATETIME */,

    query: undefined /* QUERY */,

    source: undefined /* STRING */,

    startDate: StartDate /* DATETIME */,

    tags: undefined /* TAGS */

};

// result: INFOTABLE dataShape: "undefined"

var result = me.QueryStreamData(params);

Could you please confirm the ThingWorx version you are on?

April 21, 2017

Hi Ankit,

many thanks for your answer.

I'm using the Thingworx 7.4

Now the service is working.

Maybe I had inverted the dates.

Sorry Ankit, is it possible to define a fixed ored of the parameters into Test mashup ?

Many Thanks

Dimitri

5-Regular Member
April 21, 2017

Things to check: select start date and end date in correct order. Sometimes end date variable show before start date and we select them incorrectly.

Output of the service is an infotable.

ankigupta5-Regular MemberAnswer
5-Regular Member
April 21, 2017

Screenshot of result: