Number of items property

Jan Schenkel janschenkel at yahoo.com
Wed Jun 9 14:24:58 EDT 2004


--- Gregory Lypny <gregory.lypny at videotron.ca> wrote:
> Hello everyone,
> 
> I've imported a tab-delimited text file into a
> field, which I know has 
> 11,000 data points in 1,000 lines and 11 columns.  A
> handler that 
> counts the number of items in each line and tallies
> them confirms this. 
>   However, the following handler, with the item
> delimiter set to tab and 
> which uses the number function to count the number
> of items directly, 
> gives me an answer of 10,001.
> 
> 	put the number of items in fld "Data"  -- returns
> 10,001 and not 11,000
> 
> That's 999 short.  My guess is that the number
> function is not counting 
> the last item on the end of each of the first 999
> lines because those 
> lines end with a carriage return and not a tab.  Any
> thoughts?  It 
> seems to me that using the number function, applied
> to items as above, 
> is more efficient and elegant than looping through
> the items in each 
> line.  Is it safe to modify its use by simply adding
> the number of 
> lines less one?  Something like this:
> 	
> 	put the number of items in fld "Data" + the number
> of lines in fld 
> "Data" - 1
> 
> 	Greg
> 

Hi Greg,

Your end conclusion is correct : when Revolution
calculates the number of items, it will use the
itemDelimiter and simply count how many times it's
present in the variable, thus happily tacking the last
item of line i and the first item of line i+1 together
and considering them as a single item.

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 


More information about the use-livecode mailing list