What's going on here?

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
bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

What's going on here?

Post by bjb007 » Sun Jul 06, 2008 6:42 pm

I have some code to create fields...

if not exists(field sector3) then
create invisible field sector3
put "7,8,9,10,11,12,25,26,27,28,29,30" into field sector3
end if

if not exists(field sector2) then
create invisible field sector2
put "5,6,17,18,19,20,21,22,31,32,33,34" into field sector2
end if

if not exists(field sector1) then
create invisible field sector1
put "1,2,3,4,13,14,15,16,23,24,35,36" into field sector1
end if

Problem was that all three fields had the sector1 contents.

However when I re-ordered them as 1,2,3 the contents
of each is correct.

Any explanation appreciated.
Life is just a bowl of cherries.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Sun Jul 06, 2008 8:48 pm

While I have no immediate explanation, I would advise that you quote the names of your fields when you refer to them:

Code: Select all

if there is not a field "sector3" then
  create invisible field "sector3"
  put "..." into field "sector3"
end if
Otherwise, Revolution starts looking for a variable named 'sector3' - and if it exists then it will see what's inside variable 'sector3' and use that as the name of the field. If such a variable doesn't exist, Revolution will create it for you and initialize its contents with "sector3".

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Post Reply