Problem with splitting a variable on a repeat for each loop

Sivakatirswami katir at hindu.org
Tue Nov 16 15:32:34 EST 2004


Aloha, we're getting some odd results trying to split SQL output on a 
"for each" loop.

See the comment below. Anyone know about this? This is a CGI running 
Revolution on Linux.

## we get some SQL data from a search
## put it into variable "sqldata"
## then:


if (the number of characters in it is zero) then
     put cr
     put cr & "<h2> Sorry, we didn't find a transcript with that 
title.</h2> " & cr
   else
     repeat for each line this_line in sqldata
       put cr
       if (first_hit is true) then
         if (the number of lines in sqldata > 1) then
           put cr & "<h2> Success, we found some transcripts for that 
title.</h2> " & cr
         else
           put cr & "<h2> Success, we found a transcript for that 
title.</h2> " & cr
         end if
       end if
       put false into first_hit
       put "Transcript:  <a 
href='http://www.himalayanacademy.com/taka/past/"
       # We used to split this_line on our previous server, using 
metacard but revolution
       # seems to have a bug; unless we use an extra container every 
other this_line
       # comes up empty after being split.  This is a work around.
       put this_line into bug_container
       split bug_container by "|"
       replace space with empty in bug_container[3]
       put bug_container[3] & "/'>" & bug_container[1] & "</a><br>" & cr
       put "<p>" & cr
     end repeat
   end if

   put "<hr></center>"
   put "</html></body>" & cr
end startup



   put "<hr></center>"
   put "</html></body>" & cr
end startup
=======

Sannyasin Sivakatirswami
Himalayan Academy Publications
at Kauai's Hindu Monastery
katir at hindu.org

www.HimalayanAcademy.com,
www.HinduismToday.com
www.Gurudeva.org
www.Hindu.org



More information about the use-livecode mailing list