cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Querying Infotable?

Highlighted
Newbie

Querying Infotable?

Hi,

I am trying to create some custom queries in order to display results of the thing's properties. I am following the format mentioned in another thread here as How to query form infotable using query function?

Like that thread I also want to execute similar sort of thing where Speed >'20' and id=1.

However, when executing the service, I get the error as Wrapped java.lang.NullPointerException Cause: null.

    var query = {

    "filters": {

    "type": "AND",

    "filters": [

          {

        "fieldName": "Speed",

        "type": "GT",

        "value": "20"

      },

      {

        "fieldName": "ID",

        "type": "EQ",

        "value": "1"

      }

    ]

  }

};

var params = {

t: result /* INFOTABLE */,

query: query

};

var result = Resources["InfoTableFunctions"].Query(params);


Please do let me know what may have been the error in the code/process and what could be the possible solution?

Thanks!

P.S. I am keeping the output of the service as InfoTable





15 REPLIES 15
Highlighted

Re: Querying Infotable?

For id=1 it's "EQ" condition not "LT"

Highlighted

Re: Querying Infotable?

Hi,

That was a typo here in the question (I corrected it now). I corrected it and tried it but the same error is displayed again.

Highlighted

Re: Querying Infotable?

I'm not sure if that's the reason, but try values without " as it are Number/Integer values

Highlighted

Re: Querying Infotable?

Also check if ti's Case Sensitive, on the where condition sample you wrote id and on the Query you wrote ID

Highlighted

Re: Querying Infotable?

I have inserted the code through the snippets and hence the values of the fieldname are directly taken from the name of the properties.  The example which I gave in my question statement was written just to introduce the problem.

I have also tried querying with just one fieldname but it throws the same error.

Highlighted

Re: Querying Infotable?

And which it's the content of the parameter t: result ( I mean previous result value )

Highlighted

Re: Querying Infotable?

This t:result , I am not sure what exactly it does, since I am just checking out the functionality by using the code provided in the thread How to query form infotable using query function?

Highlighted

Re: Querying Infotable?

That's the problem, input value t it's the table that you want to filter with the Query, if result it's null that's the reason that it fails.

Highlighted

Re: Querying Infotable?

OK, I understand. Can you maybe suggest a correct syntax for the code?

Highlighted

Re: Querying Infotable?

The code it's correct, the problem it's that you don't have an input Table where to query.

Highlighted

Re: Querying Infotable?

Ok, so my properties are stored in Value Streams, does this functionality work with those?

Highlighted

Re: Querying Infotable?

Any infotable content ( Stream, Value Stream, Infotable Property,...)

Highlighted

Re: Querying Infotable?

Ok, so I have a value stream VS1 containing the properties which I want to query. So what should be the syntax to include that in the code and make sure that it takes the values from VS1. I am a little new to this and hence some of my concepts may not be clear enough.

Thanks!

Highlighted

Re: Querying Infotable?

I think better you go through Training or documentation to learn about how data it's organized on TW and how to query it.

Highlighted

Re: Querying Infotable?

Hey,

Thanks for the quick response. I did try without " and with ' as well but nope, same error

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!