Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8648977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:26:42+00:00 2026-06-12T13:26:42+00:00

I have a number field with duplicate no’s (1,1,1,1,2,2,2,2,3,4,5 etc) which defines the position

  • 0

I have a number field with duplicate no’s (1,1,1,1,2,2,2,2,3,4,5 etc) which defines the position of the data in a view. I would like to keep this sorting or sort the data when a database.search is performed, which returns a NotesDocumentCollection.

Ulrick Krause has posted a solution using Treemap, but a Treemap doesn’t allow duplicates: http://openntf.org/XSnippets.nsf/snippet.xsp?id=sort-notesdocumentcollection-by-itemname

Any suggestions in server side JS would be really appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:26:44+00:00Added an answer on June 12, 2026 at 1:26 pm

    You could to this with a Vector instead of only adding the documents. Something like this:

    var tm:java.util.TreeMap = new java.util.TreeMap();
    
    while (doc != null) {
      var v:java.util.Vector;
      if (tm.containsKey(doc.getItemValueString(iName))) {
         v = tm.get(doc.getItemValueString(iName));
      }else{
         v = new java.util.Vector();
      }
      v.add(doc);
      tm.put(doc.getItemValueString(iName), v);       
    
      doc = col.getNextDocument(doc);
    }
    

    Then you have to iterate the Map and the containing Vectors to get your result sorted.

    Edit:

    And this is how you create the resulting Vector:

    var rl:java.util.Vector = new java.util.Vector();  
    var tCol:java.util.Collection = tm.values();
    var tIt:java.util.Iterator  = tCol.iterator();
    
    while (tIt.hasNext()) {
        v = tIt.next();
        for( var i=0; i<v.size(); i++ )
           rl.add( v.get(i) );
    }
    
    return rl;  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to have a phone number text field pre-formatted for a 10 digit
I'm newb with generics/iterators/enumerators etc. I have code, it keeps field number (int) and
I have a User model in my app, which I would like to store
I have a phone number field that can have lots of different characters such
I have a form with phone number field, i need to validate it with
Actually I have to take the sequence number in $Revisions field.
I have a table called tbl_loans which has the field loan_number . Loan numbers
I have a table called ticket , and it has a field called number
I have a detailview with a number of fields, some of which use textFieldShouldEndEditing
Possible Duplicate: Doing a phone call in LWUIT I have created text field with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.