192 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
 
Latest 7 Posts
HTML5 Canvas to PNG via RPC
Tue, Jun 21st 2016 8
Eternal fustrations with IBM "Help" - - this time trying to give them money
Mon, May 23rd 2016 8
Simple Example: Bootstrap
Tue, May 3rd 2016 8
Import CSVs into a Notes/XPage database
Thu, Mar 24th 2016 10
REST via Service Bean
Tue, Feb 16th 2016 6
Reversing the display order of a Multi-value field (XPages)
Wed, Jan 13th 2016 6
nhttp preview won't "switch ID"
Mon, Dec 7th 2015 7
Top 10
Import CSVs into a Notes/XPage database
Thu, Mar 24th 2016 10
ComboBox - Validate so default value is not selected
Wed, Jul 1st 2015 8
DirectoryNavigator via Java
Wed, Nov 4th 2015 8
Simple Example: Bootstrap
Tue, May 3rd 2016 8
Eternal fustrations with IBM "Help" - - this time trying to give them money
Mon, May 23rd 2016 8
HTML5 Canvas to PNG via RPC
Tue, Jun 21st 2016 8
StartKeys for categorized viewPanel and number column
Sat, Jul 4th 2015 7
dataTable column width
Tue, Jul 14th 2015 7
nhttp preview won't "switch ID"
Mon, Dec 7th 2015 7
Reversing the display order of a Multi-value field (XPages)
Wed, Jan 13th 2016 6


Reversing the display order of a Multi-value field (XPages)
Twitter Google+ Facebook LinkedIn Addthis Email Gmail Flipboard Reddit Tumblr WhatsApp StumbleUpon Yammer Evernote Delicious
   

Today I needed to reverse the display of a multi-value field. It's a log of actions and we needed to show the most recent on top rather then the first added. JavaScript arrays have a reverse() function but when I took the vector I got back it was coming in as an object not an array. I didn't want to spend more time on it, so I decided to reverse the elements in the vector.  I'm showing the results in a repeat.

So what I decided to do was reverse the vector. Below is my code to do it. It takes one vector and puts all the elements into a new vector and returns that:

  var iVector = new java.util.Vector();
    iVector = SSJSgetItemValueSet(doc, "lastresult", iVector);
    var oVector = new java.util.Vector();
    for(var nV=(iVector.size()-1); nV >= 0; nV--){
        oVector.addElement(iVector.elementAt(nV));
    } 

return oVector;
 
SSJSgetItemValueSet is a function I have in a library to assure that I get a vector from a NotesItem. Here is that function:

   function SSJSgetItemValueSet(iDoc:NotesDocument, iItemName:String, iVector:java.util.Vector) {
    //this is designed to see if there is any value in the field, and if so, to get all of it.
    //if there is only one value, still put it in a vector
    //if null, put null in as the value
    //java.util.Vector.size() is the # of elements in the vector
    //call as: iVector = SSJSgetItemValueSet(nDoc, approvedField, iVector);
    //this overloaded method is for when we want to do this from an XPage, and we can't pass a Notes object (like a Doc) into a bean,
    iVector = null; // always set to null
        try {
            if (iDoc.hasItem(iItemName)) {               
                var iItem:NotesItem = iDoc.getFirstItem(iItemName);
                var passObj = getValueAsVector(iItem.getValues());
                iVector = passObj;
            } else {
                iVector = null;
            }
        } catch (e) {
            e.toString();
        }   
    return iVector;
}
Hopefully this will be useful for someone.

Cheers,
Brian




---------------------
http://dominoherald.blogspot.com/2016/01/reversing-display-order-of-multi-value.html
Jan 13, 2016
7 hits



Recent Blog Posts
8
HTML5 Canvas to PNG via RPC
Tue, Jun 21st 2016 1:21p   Brian M. Moore
Declan Lynch provided a Signature Capture Control on OpenNTF some time ago. I had downloaded and played with it a bit, but hadn't had a production use for it, but it worked just like it said on the tin - drop it in and use it. Recently I was asked to come up with a way to let people sign into an event using tablets, so a perfect opportunity to pull it out. It was a breeze to add it to the sign-in portion, we display a page on a mobile device and the user can sign in on the canvas. That was the
8
Eternal fustrations with IBM "Help" - - this time trying to give them money
Mon, May 23rd 2016 11:22a   Brian M. Moore
So I find I need to purchase a Domino license again, this happens for independent developers. I make my selection and get taken to what IBM is now calling the "Marketplace" to check out. However the option to enter a credit card to actually pay for my purchase is greyed out. So I call in. There is a wait and a lady answers. She asks the typical questions and then for me to send them an email with a screen shot. I ask for a ticket number so I can track this request (my reopened ticket for Bluem
8
Simple Example: Bootstrap
Tue, May 3rd 2016 8:23p   Brian M. Moore
The Bootstrap library is a great way to do responsive design, and it's been incorporated into the Extension Library so you can use it "out of the box". The problem I've found is that the samples provided are pretty complex. Not too helpful if you are starting out since you have to try to figure out callbacks and a lot of other stuff to get to the points you want. I think overly complex starter examples are a waste. They let the creator think they have provided something without actually hel
10
Import CSVs into a Notes/XPage database
Thu, Mar 24th 2016 9:17p   Brian M. Moore
We have not had a direct way to import into Notes since it became impossible to save a file in .123 format (or .wk4). I loved being able to import from a view. To work around this, some years ago I created an agent that used MSExcel and two files. That worked when I had MSExcel on my machines, but I don't any more, especially for my personal machines where I won't pay for it. So I needed to change to to import CSV files, which I can do via LibreOffice. So I updated what I had posted in 2009.




Created and Maintained by Yancy Lent - About - Planet Lotus Blog - Advertising - Mobile Edition