davidvilla
Member
I am using 11.1 version of Progress and writing a oo code.
I have a class with few methods defined as static and is querying a table.
When I tried to invoke the methods dynamically using DYNAMIC-INVOKE, i got the error "Static methods, property accessors, and constructors may only reference static members of the class. 'customer' is an instance member. (14422)".
So I removed the static keyword from the method definition and I got another error "A valid class instance or static class name is required for dynamically invoking a method or accessing a property. (15285)"
It looks like, to invoke a method dynamically, it has to be a static method and a static method cannot access a table.
Can you help me get this right?
Sample code:
I have a class with few methods defined as static and is querying a table.
When I tried to invoke the methods dynamically using DYNAMIC-INVOKE, i got the error "Static methods, property accessors, and constructors may only reference static members of the class. 'customer' is an instance member. (14422)".
So I removed the static keyword from the method definition and I got another error "A valid class instance or static class name is required for dynamically invoking a method or accessing a property. (15285)"
It looks like, to invoke a method dynamically, it has to be a static method and a static method cannot access a table.
Can you help me get this right?
Sample code:
Code:
/* TestDynamicMethod.p */
using TestDynamic.*.
define variable objTD as TestDynamic no-undo.
define variable mychar as character no-undo.
objTD = new TestDynamic().
mychar = "two".
dynamic-invoke ("TestDynamic", "method" + mychar, "1", 2 )
Code:
/* TestDynamic.cls */
using Progress.Lang.*.
class TestDynamic :
define private static variable hquery as handle no-undo.
constructor TestDynamic():
super().
message "Constructor" view-as alert-box.
end constructor.
destructor TestDynamic():
message "Destructor " view-as alert-box.
end destructor.
method public static void methodone(input ipc as char):
message "Method One" view-as alert-box.
find first customer no-lock.
end.
method public static void methodtwo(input ipc as char, input ipi as int):
message "Method TWO " view-as alert-box.
end.
end class.