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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Querying Infotable?

tyadav
12-Amethyst

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

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

tyadav
12-Amethyst
(To:CarlesColl)

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.

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

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

tyadav
12-Amethyst
(To:CarlesColl)

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.

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

tyadav
12-Amethyst
(To:CarlesColl)

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?

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.

tyadav
12-Amethyst
(To:CarlesColl)

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

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

tyadav
12-Amethyst
(To:CarlesColl)

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

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

tyadav
12-Amethyst
(To:CarlesColl)

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!

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

tyadav
12-Amethyst
(To:CarlesColl)

Hey,

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

Announcements


Top Tags