naming a field in a repeat loop

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
Glenn Boyce
Posts: 137
Joined: Thu Jul 24, 2008 11:22 pm

naming a field in a repeat loop

Post by Glenn Boyce » Tue Jul 07, 2009 6:20 am

I have a field name that will change eg fld "roll2" where the 2 is the same as the repeat loop number. what is the syntax for it. I tried fld "roll&n" but it doesn't work. I know its something like that. Any assistance appreciated

shadowslash
Posts: 344
Joined: Tue Feb 24, 2009 6:14 pm
Contact:

Post by shadowslash » Tue Jul 07, 2009 6:45 am

Hi Glenn Boyce,

Try this one: fld "roll" & n Image
Parañaque, Philippines
Image
Image

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Tue Jul 07, 2009 8:22 am

Hi Glen,

you MUST put it in parentheses to avoid a "can't find object" error!
...
fld ("name" & N)
...


Best

Klaus

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue Jul 07, 2009 8:22 am

Hi,

actually, this should probably be: fld ("roll" & n). Otherwise, you get the text of fld "roll" (which doesn't exist) with n appended to it (but the script will never get that far because field "roll" doesn't exist).

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

shadowslash
Posts: 344
Joined: Tue Feb 24, 2009 6:14 pm
Contact:

Post by shadowslash » Tue Jul 07, 2009 3:19 pm

Ohhhhh right right right! Forgot to include parenthesis... Image
Parañaque, Philippines
Image
Image

Glenn Boyce
Posts: 137
Joined: Thu Jul 24, 2008 11:22 pm

Post by Glenn Boyce » Tue Jul 07, 2009 9:22 pm

Thanks team. Got it. I knew there was a simple way of doing it.

Post Reply