Use of global variables [message #118164] |
Tue, 03 May 2005 07:15 |
jonmich005
Messages: 53 Registered: April 2005
|
Member |
|
|
I have a form with 20 columns.Their rows are being count in global.activ! And the columns where are values in are count in global.intervals!
Now my question is how I can check whether a field is changed.
Here you have my code:
go_block('lds_tl_grid');
tel_interval;
tel_activity;
:global.t:=1;
while :global.t<:global.intervals loop
go_item('tl_grid_int_'||:global.t);
first_record;
:global.teller:=0;
while to_number(:global.teller) < to_number(:global.activ) loop
:global.a:='';
:global.a:= name_in('tl_grid_int_')||to_number(:global.t);
if name_in('tl_grid_int_')||to_number(:global.t) = :global.a then
commit_form;
controle;
end if;
:global.teller:=to_number(:global.teller)+1;
next_record;
end loop;
:global.t:=:global.t+1;
end loop;
The global.a is to keep the databse value of the field which is checked.
Can anyone tell me why it odesn't work?
I think I've nowhere a check if my value is equal to my global value
|
|
|
|
Re: Use of global variables [message #118274 is a reply to message #118257] |
Wed, 04 May 2005 01:51 |
jonmich005
Messages: 53 Registered: April 2005
|
Member |
|
|
I now have used 2 global variables.
One which is always empty and one with the value of my field and then I update each field even if it isn't changed.
This takes a little more time but now I'm going to see if it works.
Could you give me a little more explanation about a control block?
|
|
|
|
|
|
|
Re: Use of global variables [message #118292 is a reply to message #118164] |
Wed, 04 May 2005 03:04 |
|
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
There are often many ways of writing a form. It is just that some of us prefer to do things a certain way. I DON'T like using globals EXCEPT for global things. That is, something that is going to be used across multiple forms and even in that case I prefer to use variables in database packages. If I had my way there would NOT be any globals. They are a hangover from Forms 2 and 3 (I haven't worked with Forms 1) where they were the only way to pass parameters between forms, and as many applications have been converted up through the versions of Forms, but not rewritten, the parameter passing is those applications is still done via globals.
David
[Updated on: Wed, 04 May 2005 03:06] Report message to a moderator
|
|
|
|