Error in range start expression

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
A1Qicks
Posts: 79
Joined: Sat Dec 26, 2015 10:47 am

Error in range start expression

Post by A1Qicks » Tue Jan 05, 2016 11:56 pm

I ask a lot of questions. I hope no one minds - I'm very stupid and very persistent.

I've got this little clause in my code - it's pulling information from a MySQL database and puts it into tName and tMessage for this part, and I'm trying to get it so it posts item 1 of tName, then item 1 of tMessage, then item 2 of tName, and item 2 of tMessage, and so on until it runs out:

else
set itemDelimiter to return
put 1 into tMessageCount
repeat for each item theNames in tName
put "<" && item theNames of tName && ">" after field "textDisplay"
put item tMessageCount of tMessage after field "textDisplay"
add 1 to tMessageCount
end repeat

However I get an error for the illustrated line in "range start expression". The variables all seem to be what they should be at this point. I looked at other people's solutions across the internet and tried "repeat with i = 1 to the number of lines of tName" instead but it didn't change anything. Still got the same error in the same place.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Error in range start expression

Post by dunbarx » Wed Jan 06, 2016 12:04 am

Quick look, you are over-thinking, and therefore overCoding.

If you already have a repeat loop that extracts successive items (each instance is "theNames") then you only need to:

Code: Select all

put "<" && theNames && ">" after field "textDisplay" 
Oh, and nobody yet, ever, ever asked too many questions. if you don't, I have to actually work at my job.

Craig Newman

A1Qicks
Posts: 79
Joined: Sat Dec 26, 2015 10:47 am

Re: Error in range start expression

Post by A1Qicks » Wed Jan 06, 2016 7:37 pm

That works, thank you!

I was about to ask a further question that was tricky, but then I solved it. I love coding! It's like a lateral thinking puzzle. If you don't know the complicated way of doing something, look for an easy solution :D

Post Reply