chob1234 Posted May 30, 2019 Share Posted May 30, 2019 var params = { maxItems: 100000 /* NUMBER */ }; //// result: INFOTABLE var itPartInfo = Things["Training.InfoTable.PartInfo"].GetDataTableEntries(params); ///***************************************** // ADD YOUR CODE BELOW //*****************************************/ var query = { "filters": { "fieldName": "ID", "type": "EQ", "value": partID } //partID is an input }; var idQuery = { t: itPartInfo /* INFOTABLE */, query: query /* QUERY */ }; //// result: INFOTABLE var result = Resources["InfoTableFunctions"].Query(idQuery); So this code will return an item in an infotable(thingworx) which is basically an array of objects, it can also be thought of as a table where the array entries are rows and the object properties of each object in the array are the columns. So currently my output is displaying what I have correctly, I need to know how I could display say partID, Color, and MaterialType, my thinking was a I could use a sort function like var sort = new Object(); sort.name = Color; sort.ascending = True; itPartInfo.Sort(sort); But I am getting errors. Any suggestions? Link to comment Share on other sites More sharing options...
justsomeguy Posted May 30, 2019 Share Posted May 30, 2019 What errors are you getting? If Color is supposed to be a value and not a variable, you need to quote it. Link to comment Share on other sites More sharing options...
chob1234 Posted June 3, 2019 Author Share Posted June 3, 2019 Sorry not errors, it is returning all of the information for input partID, I thought that the sort function would return just the Color of that partID, which it is not. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 3, 2019 Share Posted June 3, 2019 It seems like a sort function would just change the order that the results appear. If you want to limit what is returned you probably have to change the table specification to tell it to only return specific columns, but I'm not familiar with what you're using. Hopefully it has documentation that you can use to check what your options are. Link to comment Share on other sites More sharing options...
chob1234 Posted June 4, 2019 Author Share Posted June 4, 2019 (edited) Yeah I think you are right on that, I believe the only way as of now in the thingworx platform to remove undesired columns is the .removeField("field") function, which you would have to have a function for every single column which is very inconvenient. Edited June 4, 2019 by chob1234 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now