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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Query-sorts works when I test the service, but not in the mashup

tcoufal
13-Aquamarine

Query-sorts works when I test the service, but not in the mashup

Hi Guys,

I am dealing with one issue that drives me crazy.

I have a DataTable. I am storing data into it as they come. For some reason they are not sort by the Key (it is a timestamp).

So I would like to sort it with following query (property, datatype: Query):

If I test the service manually, it works as expected - results are sorted  (with sorts and with filters as well):

But When I try to do it via mashup, it does not seem to work. Result is not sorted. I have also try it via DataFilter widget - that does not accept Sorts queries (Filters seem to work fine).

Is there some special format which I should use so I can bind Query properties directly to QueryServicesParameters?

I would like to avoid to create a special service which takes the Query property and calls normal QueryDataTableEntries. I have lot of mashups which I am using standard service and it would be a pain to change it all.

Thanks.

ACCEPTED SOLUTION

Accepted Solutions
tcoufal
13-Aquamarine
(To:tcoufal)

It turns out, that is better to write a service which fills your query instead of writing it directly via SET button.

This is my fillQuery service:

var query =

{

    "sorts": [

        {

            "fieldName": "timestamp",

            "isAscending": false           

        }

    ],

    "filters": {

        "type": "And",

        "filters": [

            {

                "type": "GT",

                "fieldName": "AccChannel1",

                "value": "0.05"

            },

            {

                "type": "GT",

                "fieldName": "AccChannel2",

                "value": "0.05"

            }

        ]

    }

};

me.TimestampDescendingSortQuery = query;

This resulting to:

{"filters":{"filters":[{"fieldName":"AccChannel1","type":"GT","value":"0.05"},{"fieldName":"AccChannel2","type":"GT","value":"0.05"}],"type":"And"},"sorts":[{"fieldName":"timestamp","isAscending":false}]}

Assigning query variable to query Property does something on formatting level..

View solution in original post

1 REPLY 1
tcoufal
13-Aquamarine
(To:tcoufal)

It turns out, that is better to write a service which fills your query instead of writing it directly via SET button.

This is my fillQuery service:

var query =

{

    "sorts": [

        {

            "fieldName": "timestamp",

            "isAscending": false           

        }

    ],

    "filters": {

        "type": "And",

        "filters": [

            {

                "type": "GT",

                "fieldName": "AccChannel1",

                "value": "0.05"

            },

            {

                "type": "GT",

                "fieldName": "AccChannel2",

                "value": "0.05"

            }

        ]

    }

};

me.TimestampDescendingSortQuery = query;

This resulting to:

{"filters":{"filters":[{"fieldName":"AccChannel1","type":"GT","value":"0.05"},{"fieldName":"AccChannel2","type":"GT","value":"0.05"}],"type":"And"},"sorts":[{"fieldName":"timestamp","isAscending":false}]}

Assigning query variable to query Property does something on formatting level..

Announcements


Top Tags