Skip to main content
Known Participant
September 29, 2010
Question

Comparing text lists.

  • September 29, 2010
  • 2 replies
  • 427 views

Help – been up all night and brain is flat…

I have a text list, which I need to compare with n-amount of other lists.  IE:

Original list: “beer, whisky, wine, vodka, tequila”

Then I have:

List 2: “beer, chocolate, nuts”

List 3: “whisky, bacon, beer”

List 4: “chocolate, bacon”

Etc…

I need a script that compares my original list with list 2, 3 & n, and return the list number that matches ANY of the list elements.  IE my result set would be “2, 3”.  (the ID of the lists returned as a valuelist)

Bonus point if you can arrange them by the amount of matches – “3, 2” – but non-essential. 

Point me in the right direction please!

    This topic has been closed for replies.

    2 replies

    Inspiring
    September 29, 2010

    Try this link

    http://ppshein.wordpress.com/2010/06/16/compare-list-in-coldfusion/

    as it returns a matching list, you can work out the number of matches per list too...

    existdissolve
    Inspiring
    September 29, 2010

    I would suggest starting out at cflib.org and do a search for "list"--there are a billion ready-made scripts for comparing/parsing/transforming lists that, while they may not knock out your solution in one fell swoop, will at the very least get you started in the right direction.