Question
· Jun 21, 2021

Data Structure and Sorting Algorithm


Besides objectscript's own list, array data structure, are there any other data structures that have been implemented, similar to the "collection" package in java, or is there a ready sorting tools for the collection class.

Discussion (3)1
Log in or sign up to continue

We've previously passed the data into new indices to utilise the auto sorting nature of the objectscript arrays, using a number based or alphabetical index depending on how we're hoping to organise the data.

eg. s NewData(Data(Key,"Name")) = Data(Key)

With object classes or mapped globals we tend to use the sql queries to sort the data as required lately. 

There are the json and dynamic arrays that can be used for collection / array data storage.

It gives you a greater degree of control compared to some languages. I'm not aware that many other languages have a sort thats particularly more sophisticated in reality its probably doing the same just 'under the covers' as theyre higher level than objectscript. The alternative is to pass the data out to whatever front end you're using and have it sort prior to displaying but then most likely its the client doing that work rather than your server.