Page 1 of 1

What's going on here?

Posted: Sun Jul 06, 2008 6:42 pm
by bjb007
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.

Posted: Sun Jul 06, 2008 8:48 pm
by Janschenkel
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.