EmpDep Frame
The EmpDep Frame, shown in the following figure, lets you query the Employee table to display data about specific employees. The frame demonstrates the use of hidden fields and invisible fields.
When a user selects the GetEmployee menu operation, the frame checks the Dependents table. If the employee has dependents, then the "dependents" table field is displayed and the hidden field "deps" is set to y; otherwise the table field is invisible and "deps" is set to n.
The following is the 4GL source code for this frame:
/* * Empdep.osq *
** View and Update Emp and Tasks information.
**
*/
initialize (resp = c3, curr_field = c32)=
begin
mode query;
today = date('now');
callproc timer_on(secs=15);
end
GetEmployee, key frskey4 =
Begin
empdep = select name, title, manager, hourly_rate
from emp
where qualification(name=name,title=title,
manager=manager, hourly_rate=hourly_rate)
dependents = select distinct *
from dependents
where name=:name
order by birth
begin
initialize =
begin
if :dependents[1].depname = " then
set_forms field "
(invisible(dependents)=1);
deps = 'N';
else
set_forms field "
(invisible(dependents)=0);
deps = 'Y';
endif;
redisplay;
end
'Next', key frskey4 =
begin
message 'Retrieving next Employee.';
next;
if :dependents[1].depname = " then
set_forms field "
(invisible(dependents)=1);
deps = 'N';
else
set_forms field "
(invisible(dependents)=0);
deps = 'Y';
endif;
redisplay;
end
'Quit', key frskey3 =
begin
endloop;
end
on timeout =
begin
today = date('now');
end
end;
set_forms field "
(invisible(dependents)=1);
clear field all;
today = date('now');
redisplay;
end
'4GL', key frskey16 =
begin
helpfile 'Employee-Dependents Frame 4GL'
'USER:[JOE.ABFDEMO]EMPDEP.OSQ';
end
'Help', key frskey1 =
begin
help_forms (subject = 'Employee Information',
file = "USER:[JOE.ABFDEMO]EMPDEP.HLP');
end
'Quit', key frskey3 =
begin
callproc timer_on(secs=2);
return;
end
key frskey2 =
begin
exit;
end
on timeout =
begin
today = date('now');
end
Last modified date: 08/14/2024