Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Developer
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified
Accepted Solution

"Order by" in Persistent store

[ Edited ]

Hi,

 

I want to sort persistent store records,by implementing a query like 

 

"Select TimeStamp from Table where ID =  + someID order by Date desc limit 0,1"

 

How do I order records in store and pick up latest date?

 

 

Please help

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: "Order by" in Persistent store

There is, as far as I am aware, no Sortable collection that can be added to PersistentStore.

 

So I do this sorting as I extract the persistent records from persistent store.

 

In short, if you want this functionality, you have to code it yourself. 

Developer
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified

Re: "Order by" in Persistent store

[ Edited ]

I am fetching all contents into vector, is it possible to implement sorts in vector ?

 

Or even Hashtable? 

 

 

Or can anyone help me with sample code?

Developer
Posts: 455
Registered: ‎01-14-2009
My Device: Apple iPhone 3GS 16GB

Re: "Order by" in Persistent store

As peter said, get the data from the store and then sort it yourself .

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: "Order by" in Persistent store

Have a look round the sorting collections that are available - for example SimpleSortingVector. 

Developer
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified

Re: "Order by" in Persistent store

SimpleSortingVector helped me   Smiley Happy

 

Thanks Peter...