Sorting the output of a SmartObject 'Get List' method

  • 13 February 2008
  • 5 replies
  • 1 view

Badge +7

Is this possible as part of the SmartObject definition..


I've got an InfoPath form that shows as a repeating section the output of a Get List method on one of my SmartObject, and i'd like to sort this data by one of the date/time fields.... i'd rather not start implementing InfoPath code before trying to see if there's a nice way to do it in K2 [blackpearl]


Martin


5 replies

Badge +3

Hi


We could not find a way to do this with SmartObjects (See my SO enhancement request thread http://k2underground.com/forums/thread/21572.aspx). The only way that this can be done (would like to be proven wrong), and this approach is ugly, is to:



  • Execute your GetList method
  • Then call a Save method to persist your data back to the SmartBox (have a primary key on the column you want ordered)
  • Then execute a GetList method to retrieve the ordered data.

We have ended up writing our own AD Service Object that allows us to specify what SmartObject column is to be sorted.


I believe that the ordering functionality should be provided by the SmartObject, so that we are not having to write code behind on InfoPath forms nor any sort of Client side Javascript. My $0.02


Cheers



 


 

Badge +5

Hi,


This sort issue is really needed. In my case i have a SmartObject to pull out AD Users and populate an Infopath dropdown.


Everything works well except the sort, i.e. i'm not able to sort the values and so the AD users appear completely random.


Any solution to achive the sort directly through K2 SmartObject would be the best option but don't know how-to / if possible.


Cheers

Badge +3

Hi Jarrostick


Absolutely agree with your sentiments. 


 A word of warning when using the AD Service Object, you will get different results (a diiferent number of users) when using the AD service Object vs when retrieving users via the URM service object. We have raised a support ticket regarding this problem.


The URM Service Object works as expected and returns the correct number of users but the problem with this is that although it contains a user friendly name property it won't return user friendly name's only User Name's (i.e Domain NameUserId)!!


Also the AD Service Object returns only a max of 1,000 users (this I am sure is not by design).


We are in the throws of putting together our own custom designed AD Service Object that allows you to specify what column you would like to sort by (we are nearly finished this).


 Happy to post this to underground if there is a need for it.


 Cheers


R


 


 


 


 

Badge +7

Hi RobinD 


Hmmm... thanks for your reply


This is indeed very disapointing.... if I want to sort based on the SmartObject primary key (in reverse order) I will now have to write some hideous InfoPath script to achieve this


oh well


Martin


 

Badge +3

Hi All


 For anyone that is interested I am about to post (hopefully sometime today) a DLL along with sourcecode that allows folk to create a Service Object to retrieve users from AD and specify what AD field that the information is to be sorted by. Users specify what field is to be sorted via a prepopulated Service Object Method Input parameter.


 Hope this may be of use while the support ticket for the K2 AD Service Object bug is resolved.


Cheers


Robin


 

Reply