SKILL Q: Getting a Sorted List of db objects?

Discussion in 'Cadence' started by Edward, Aug 9, 2007.

  1. Edward

    Edward Guest

    The function geGetSelSet() seems to build a list in the same order
    that the objects were selected. Normally, I like this. But I want
    to make a copy of this list of db-objects in alphabetical order with
    respect to ~>objType .

    Here is my code:

    (sort
    (geGetSelSet)
    (lambda (x y)
    (alphaNumCmp
    (dbGetq x "objType")
    (dbGetq y "objType"))))

    Running this code seems to have no effect whatsoever. Whatever item I
    selected first is still always the first item in the list, as if I
    never ran the list through a sort at all. What am I missing? Thanks
    in advance.

    Edward
     
    Edward, Aug 9, 2007
    #1
  2. Edward

    S. Badel Guest

    Try alphalessp() instead of alphaNumCmp().

    alphaNumCmp does not seem to work with sort, i guess this is because
    sort expects a boolean (nil or t) and alphaNumCmp returns an integer
    (-1, 0 or 1) which is always "true"...

    Stéphane
     
    S. Badel, Aug 9, 2007
    #2
  3. Edward

    John Gianni Guest

    John Gianni, Aug 14, 2007
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.