Skip to main content
1-Visitor
June 18, 2015
Solved

Query ValueStream with null entries

I get the following error when invoking a simple query on a value stream (using the DataFilter and TimeSelectors in the mashup).

 

[context: com.thingworx.webservices.context.HttpExecutionContext@71e1b30c][message: Unable to Invoke Service QueryPropertyHistory on N4A_Thing : null]

 

Is this because the field I am querying has null values?  The query is simply gps_status equals to 1.  There are lots of entries where this exists, but all I get is the error.

 

If I am not allowed to have null entries in the ValueStream, then how do I avoid this?  I need to filter out invalid location data when the GPS status is not valid.

    billreiAnswer
    12-Amethyst
    June 19, 2015

    Unfortunately, null in this case is probably the text description of the exception being thrown and not a reference to the values in your value stream. Could you try to make this call within a service to eliminate the possibility of a problem with your mashup bindings?

    3 replies

    billrei12-AmethystAnswer
    12-Amethyst
    June 19, 2015

    Unfortunately, null in this case is probably the text description of the exception being thrown and not a reference to the values in your value stream. Could you try to make this call within a service to eliminate the possibility of a problem with your mashup bindings?

    Translate
    1-Visitor
    June 22, 2015

    Bill,

    Thanks for the response. 

    I try to test the query using a the built in QueryPropertyHistory, but get an error on my query syntax.  What is the correct syntax to perform the SELECT * WHERE gps_status = 1....This SQL type query gives an error about not following JSON query.  I am not familiar with, or can I find reference to JSON query....

    Invalid QUERY value. Please make sure it's a valid JSON string


    Thanks for the help!

    Rob

    Translate
    1-Visitor
    November 25, 2015

    What is your actual query ?

    Based on the DOC 6.5 (http://support.ptc.com/cs/help/thingworx_hc/thingworx_6.5_hc/index.jspx?id=QueryParameterforQueryServices&action=show):

    var query =

    {

          filters:

         {

              type: "EQ",

              fieldName: "gps_status",

              value: "1"

         }

    };

    Translate