Articles Archive
Director Forums
Director Wiki
Job Board
Search
 
Lingo Programming :  Director Online Forums
Questions about Lingo programming at all Levels 
Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
Problem with lists...
Posted by: sroberts (---.net)
Date: July 17, 2006 08:01AM

Hi guys,

My first post. I am not big director user. Although I have been using it on and off for the last seven years. So I have a real love, hate relationship with the program.

Anyway my question. I am in the middle of producing a CD that is powered by an access DB. I am using Datagrip to pull the data from access. But I have a problem. I am returning one of the columns/fields as a list. But I need to remove any duplications from the list. How do i go about doing this???? I have had a search on here and can not seam to find anything.

Any ideas?

Thanks
Si



Edited 3 time(s). Last edit at 07/17/2006 08:08AM by sroberts.



Re: Problem with lists...
Posted by: sroberts (---.com)
Date: July 17, 2006 08:17AM

Sorry forgot an example...


gInboundList =["blah", "blah", "blah", "blah1", "blah2", "blah3", "blah3", ]

I need to be able to process this and remove the duplicates. But really not sure on how to go about it or where to begin.

Thanks
Si



Re: Problem with lists...
Posted by: Aldus (---.dip.t-dialin.net)
Date: July 17, 2006 08:25AM

A simple way could be
on RemoveDoubles (aList)
  tempL = []
  repeat with i in aList
    if (getOne(tempL, i) = 0) then tempL.add(i)
  end repeat
  return tempL
end
Copying the list by looking if the element still exist, and if not, adding
it to the new one:
l = [1,1,2,3,4,5,6,7,1,1,7]
put RemoveDoubles(l)
-- [1, 2, 3, 4, 5, 6, 7]
hih
Aldus

-------------
http://www.drp-x-work.de/doug/aldus_01.gif



Re: Problem with lists...
Posted by: Aldus (---.dip.t-dialin.net)
Date: July 17, 2006 08:34AM

-- Sorry, i knew: first test, then post. Sorry for the typos in the last one
on RemoveDuplicates (aList)
  newList = []
  repeat with i in aList
    if (getOne(newList, i) = 0) then newList.add(i)
  end repeat
  return newList
end
Regards
Aldus

-------------
http://www.drp-x-work.de/doug/aldus_01.gif



Re: Problem with lists...
Posted by: sroberts (---.co.uk)
Date: July 17, 2006 08:42AM

Thank you! That worked a treat!

Si



Edited 1 time(s). Last edit at 07/17/2006 08:53AM by sroberts.





Sorry, only registered users may post in this forum.
This forum powered by Phorum.