Home > Community > Forums > Custom IC SKILL > sorting a db list by db~>cellName

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 sorting a db list by db~>cellName 

Last post Mon, Jul 6 2009 3:15 PM by isgdude. 2 replies.
Started by isgdude 06 Jul 2009 02:51 PM. Topic has 2 replies and 872 views
Page 1 of 1 (3 items)
Sort Posts:
  • Mon, Jul 6 2009 2:51 PM

    • isgdude
    • Not Ranked
    • Joined on Thu, Feb 26 2009
    • Posts 6
    • Points 90
    sorting a db list by db~>cellName Reply

    I have a list of hierarchical schematic db objects and would like to sort them by cellName.

    dblist = ( db:00001 db:00002 db:00003 )

    dblist~>cellName = ( "BBBB" "CCCC" "AAAA" )

    I would like this returned:

    ( db:00003 db:00001 db:00002) 

     Thanks

     

     

     

    • Post Points: 20
  • Mon, Jul 6 2009 3:07 PM

    • dmay
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 393
    • Points 7,415
    Re: sorting a db list by db~>cellName Reply

    dbList = sort(dbList lambda((a b) alphalessp(a~>cellName b~>cellName)))

    Essentially the sort command accepts a function as the second argument. The function takes two arguments and returns t or nil. The preceding example could also be written this way:

    dbList = sort(dbList 'mySort)

    procedure(mySort(a b)
        alphalessp(a~>cellName b~>cellName)
    )

    Derek

    • Post Points: 20
  • Mon, Jul 6 2009 3:15 PM

    • isgdude
    • Not Ranked
    • Joined on Thu, Feb 26 2009
    • Posts 6
    • Points 90
    Re: sorting a db list by db~>cellName Reply

    That did the trick

    Thanks Derek

    • Post Points: 5
Page 1 of 1 (3 items)
Sort Posts:
Started by isgdude at 06 Jul 2009 02:51 PM. Topic has 2 replies.