Page 1 of 1

Counting number of lines of TEXT

Posted: Tue May 29, 2012 10:47 am
by Nakia
Hi.

I have a text fld that I need to check that it contains a FULL 19 lines of TEXT (Each line must contain TEXT).
I have the following below but it is counting empty lines which is not suitable for my purpose.
Is there a way to calculate number of lines of Text That actually contain Text?


Code: Select all

on checkFullData
   if number of lines of formattedText  of field "ScoreRunS1" = "19"
   then
      writeData
   else
      answer warning "Data Missing, Please enter a full set of scores" titled "Validating Data"
   end if
end checkFullData

Re: Counting number of lines of TEXT

Posted: Tue May 29, 2012 12:06 pm
by Klaus
Hi Nakia,

do this:
1. get thet text you want to check
2. delete all empty lines!
3. do your count and check

Code: Select all

...
## Always a good idea to put text into a variable, since accessing FIELDS is much more time consuming than this!
put the text of fld "xyz" into tCompleteText

## Remove empty lines! 
## Check "FIULTER" in the dictionary!
filter tCompleteText without EMPTY

## No do the count
## Hint: no quotes around numbers!
if the num of lines of tCompleteText <> 19 then
   writedata
else
   ## blame user here..
end if
...
Best

Klaus

Re: Counting number of lines of TEXT

Posted: Wed May 30, 2012 8:55 am
by Nakia
Thanks so much.
Worked exactly as expected.