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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

How to sort the result of the Services?

xcheung
1-Newbie

How to sort the result of the Services?

Hi all,

I am now using File Repository Thing template to get ftp file info, and one of its service is called "GetFileListingWithLinks".

The result is an infotable, but I dont know how to sort the result by LastModifiedTime, which is one of the columns in the result table. (Cannot see/modified the code inside..).

I hope to get the latest File Info, so hope someone can help.

Thanks!

3 REPLIES 3
supandey
19-Tanzanite
(To:xcheung)

Hi Xiaoying, if the service you are using has the option to include Query parameter you can consider including the Sort option, this is covered in the Help documentation you can check here

ssauvage-2
13-Aquamarine
(To:supandey)

Hi.

 

I think "sorts" parameter must be inside "filter" parameter, which contains also "filters" parameter...

So something like this:

 

filter: {
      "sorts": [
          {
              "fieldName": "UID",
              "isAscending": false
          }
      ],
	"filters": {
		"fieldName": "Name",
		"type": "EQ",
		"value": "myNameValue"
	}
}

Sébastien

Alternatively you can use also Sort snippets, there's two:

// Option 1 - In-place

myInfotable.Sort({ name: "fieldName", ascending: true/false });

// Option 2 - New Sorted Infortable

var myInfotableSorted = Resources["InfoTableFunctions"].Sort({

    t: myInfotable,

    sortColumn: "fieldName",

    ascending: true/false

});

Top Tags