Thursday 15 September 2011

Interesting wee additional method for Lotusscript (yes you read that right)

Well I never!
Yes you did read the title of this post correctly I have discovered a NEW thing in Lotusscript.
I know I too had to sit down and have a long cup of tea and a biccie to recover from the shock not only that there is something new but (a) it is useful and (b) it works really well.



I speak of  NotesView.ReSortView("columnname",AscendingFlag)


Now what this does, although not explicit in the help is , if you have a view and the columns have the "Click on column headers to sort = Both" turned on you can in Lotusscipt ask the view to be Resorted based on the programatic name of the column you want the view to be sorted on.

You do not have to set the column to be sorted by default (this reducing what could be a VERY silly view size) you just have to have the "Click column headers to sort = BOTH" turned on.

What this meant to me was I could have a web agent that returns data to an AJAX request that was sorted in a user defined way at the click of a button!! FANTASIC no more messing around with empty documentcollections, sorting lists and adding the documents from the orginal back into the empty collection. All I needed to do was

Call MyView.ReSortView("OrderQuantity",True) 
to sort the view into the order I wanted and deliver it to the wating browser.

The Second parameter is TRUE = Ascending or FALSE = Descending. A word of caution on this param, it appears not to be accessible when you pass it as a variable. You need to pass it as an actual value rather than a Boolean Variable.Also if you have something other than "Click on column headers to sort = Both" this second variable is ignored and the view is sorted on what ever you have set as the value for "Click on column headers to sort"

Really very useful for fiddling with views.. THANK YOU the Dev team in IBM :)





Disqus for Domi-No-Yes-Maybe