Examples—Method Invocation Statement
Write out a StringObject to a file:
method exmpl (
outputtext = varchar(256) not null;
filename = varchar(256) not null;
)=
declare
(strobj = StringObject;
retval = integer not null;
enddeclare
) =
begin
strobj.Value = outputtext;
retval = strobj.WriteToFile(filename = filename);
if retval != ER_OK then
message 'Error writing file.';
endif;
end
Invoke a method on an option field called statechoices, with no parameters and no return value:
field(statechoices).UpdchoiceList();
Use a dynamic name to set the value of an attribute of the user-defined class Addr:
method exmpl ()=
declare
attname = varchar(32) not null;
empaddr = Addr;
value = varchar(20) not null;
enddeclare
begin
empaddr.City = 'New York';
attname = 'city';
value = 'Chicago';
empaddr.SetAttribute(:attname = value);
message 'value is' + empaddr.City;
/* It will be Chicago */
empaddr.City = 'New York';
empaddr.GetAttribute(:attname = byref(value));
message 'value is ' + value;
/* It will be New York */
end