?
Solved

need to find  item from list

Posted on 2013-01-23
5
Medium Priority
?
204 Views
Last Modified: 2013-01-23
Hi, I need to find 69 from 65 - 72 how can i do, i tried listfind, listcontains, none working
0
Comment
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:Tomarse111
ID: 38809634
So your string would be:

65,66,67,68,69,70,71,72 ??

and you want to check if 69 is in it?

What version of CF are you using?

Bit more information would be helpful

Tom
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 38809663
i used this function

function listFindMissing(list) {
  var delim="-"; // list delimiter
  var arrToSearch="";
  var i=0;
  var j=0;    
  var returnList="";
  if(arrayLen(arguments) GTE 2) delim = arguments[2];
  arrToSearch=listToArray(list,delim);
  for(i=ArrayMin(arrToSearch);i LTE arrayMax(arrToSearch);i=i+1)
    for(j=1;j LTE arrayLen(arrToSearch);j=j+1)
      if(arrToSearch[j] EQ i)  break;
      else
        if (j EQ arrayLen(arrToSearch))
          returnList = listAppend(returnList,i,delim);
  return returnList;
}

but it is skipping the first and the last letter say

the values are 65-72

it shows me 66,67,68,69,70,71

i need the start and the end too of this
0
 
LVL 16

Author Comment

by:Gurpreet Singh Randhawa
ID: 38809665
i am on cf 10
0
 
LVL 15

Accepted Solution

by:
Tomarse111 earned 2000 total points
ID: 38809737
Removing your check fixes it but dont fully appreciate the implications, if any of doing that:

function listFindMissing(list)
	{
		var delim = "-";// list delimiter
		var arrToSearch = "";
		var i = 0;
		var j = 0;
		var returnList = "";
		if(arrayLen(arguments) GTE 2)
			delim = arguments[2];
		arrToSearch = listToArray(list, delim);		
		
		for(i = ArrayMin(arrToSearch); i LTE arrayMax(arrToSearch); i = i + 1)	
			returnList = listAppend(returnList, i, delim);
					
		return returnList;
	}

Open in new window

0
 
LVL 16

Author Closing Comment

by:Gurpreet Singh Randhawa
ID: 38809771
Thanks
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question