Function VLOOKUP in Excel: which is the equivalent in REV?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Sun Aug 16, 2009 5:21 pm

Daross wrote:A question; what is aLine?
It's a variable name to hold the data for each line in turn as it loops through the text.

Take a simpler example where

Code: Select all

repeat for each line aLine in tText
    put item 2 of aLine & cr after field "DestinationListField" 
end repeat
and say tText holds

Code: Select all

Line 1,Cat,Some more data
Line 2,Dog,Extra info
Line 3,Fish,Who knows what else?
Line 4,Wildebeest,Hey - isn't that the same as a gnu?
We could say something like:
"repeat for each line [[and we're going to have a variable name here that we have called "aLine" to hold the value concerned each time we go through the loop, otherwise how will our routine know what to do with any of the data?]] in tText"
When the loop is started, the first time around it will put "Line 1,Cat,Some more data" into the variable aLine. Then item 2 of aLine will be "Cat" and it will put that into the destination field. Next time around the loop it will put "Line 2,Dog,Extra info" into aLine, and put item 2: "Dog" on the next line after the destination field. etc. etc.

You can loop though all sorts of containers in the same way, such as

Code: Select all

repeat for each item theItemVariable in aLine
also nesting the loops if you need to.

I hope that makes it clearer.

Daross
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 23
Joined: Thu Jun 04, 2009 8:15 pm

Post by Daross » Mon Aug 17, 2009 3:55 pm

SparkOut,

now everything is clear, thanks

Post Reply