Array of fields

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

Post Reply
proza
Posts: 14
Joined: Thu Jul 12, 2007 3:34 pm

Array of fields

Post by proza » Fri Jul 13, 2007 4:08 pm

I have a number of fields on a card labelled "f1", "f2", "f3", etc

I would like to ask is it possible to access then like an array?

For example:

repeat with i=1 to whatever
put i into field "f" & i
end repeat

Thanks!

xApple
Posts: 113
Joined: Wed Nov 29, 2006 10:21 pm
Location: Geneva

Post by xApple » Fri Jul 13, 2007 7:23 pm

Yes absolutly, your code seams to be functional. Is it not ?
To add a layer of abstraction to commands you write in trascript the merge() and format() command are intresting. You can find a few exemples here:
http://forums.runrev.com/phpBB2/viewtopic.php?t=487

proza
Posts: 14
Joined: Thu Jul 12, 2007 3:34 pm

Post by proza » Sat Jul 14, 2007 4:19 am

When I click Apply, there is an error complaining about the & sign.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Sat Jul 14, 2007 7:53 am

Hi proza,

use brackets and it will work :-)

repeat with i=1 to whatever
put i into field ("f" & i)
end repeat

Rev will evaluate the string first to "f1", "f2" etc.


Regards

Klaus


P.S.
But an array is a complete different animal ;-)

proza
Posts: 14
Joined: Thu Jul 12, 2007 3:34 pm

Post by proza » Mon Jul 16, 2007 4:31 am

Thanks Klaus.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”