Solved

need to find  item from list

Posted on 2013-01-23
5
190 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 15

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 15

Author Comment

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

Accepted Solution

by:
Tomarse111 earned 500 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 15

Author Closing Comment

by:Gurpreet Singh Randhawa
ID: 38809771
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

930 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now