Skip to main content
Jan 11, 2019 9:41 AM UTC
Solved

Data filter usage

Hi,

I wanted to use the data filter widget but am not able to get the exact out. This is the service i wrote for filtering.

var query =
{
"filters": {
"type": "And",
"filters": [
{
"type": "Matches",
"fieldName": "ParameterVal",
"value": "*"
},
{
"type": "Matches",
"fieldName": "AlarmCategory",
"value": "*"
}
]
}
};

var params = {
ValueQuery: Query /* STRING */,
CategoryQuery: Query /* STRING */
};

// result: INFOTABLE dataShape: DataFilterTesting_DS
var result = Things["TestingThing"].DataFilterTesting(params);

 

DataFilterTesting is another query which has (select * from AlarmType where AlarmCategory = [[CategoryQuery]] or ParameterVal = [[ValueQuery]])

 

How am I suppose to proceed? Please provide some help.

Thanks,

Shalini V.

 

 

 

 

Jan 12, 2019 9:01 AM UTC

You are combining TW standard Query parameters with SQL services, and it's now how it works.

 

If you are using standard TW query features, you have to relay on Query services like:

  1. SearchAll/Data/ModelEntities/...
  2. QueryImplementingThings/WithData/WithNamedPro....
  3. and others alike (Infotable query features)

On thouse services you will be able to use the query like parameters you wrote.

 

If you are connecting to a custom database then you can't use the previous query services and format and you should use the standard SQL query formating for the given database on SQL services.

3 replies

Jan 11, 2019 8:09 PM UTC

Hi @svisveswaraiya_285988.

 

Can you show us DataFilterTesting?  Also, you indicated you were not able to get the exact output with the data filter widget.  What output are you expecting?

 

When you run this, are you actually using wildcards or is that just an example?

 

Please provide further details and we will try to assist.

 

Regards.

 

--Sharon

Jan 12, 2019 9:01 AM UTC

You are combining TW standard Query parameters with SQL services, and it's now how it works.

 

If you are using standard TW query features, you have to relay on Query services like:

  1. SearchAll/Data/ModelEntities/...
  2. QueryImplementingThings/WithData/WithNamedPro....
  3. and others alike (Infotable query features)

On thouse services you will be able to use the query like parameters you wrote.

 

If you are connecting to a custom database then you can't use the previous query services and format and you should use the standard SQL query formating for the given database on SQL services.

Jan 25, 2019 4:24 PM UTC

Hi @svisveswaraiya_285988 

 

If the solution provided by @CarlesColl answered your question, please mark it as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon