1
votes

I had to rewrite a procedure file to a class file, however the dynamic functions can't be invoked. Is there any way to run dynamic functions in your class?

I got the assignment to change a p file into a cls file.

The method I'm speaking of is:

cBeheerder = dynamic-function ("fnBeheersgroep", nr1, nr2).

I get the error that the dynamic error couldn't be found.

1
Can you post some code to make it clear how you're approching this? Have you looked into dynamic-invoke as well (if you also converted the functions into methods, that is)? - bupereira
I updated my question, hopefully you have enough information - Gaetano Herman

1 Answers

1
votes

There's lots that could be at play here. Is your function (now a method, if I understand correctly) in the same class? Are you using dynamic-function if it's a method now (and thus you should be using DYNAMIC-INVOKE)? Does the function return character? What's the error number you're getting?

I created an overly simplified class to show how to achieve this in a simple way:

class myclass:
    method public void main():
        MESSAGE dynamic-invoke(this-object, 'fnBeheersgroep',1,2)
            VIEW-AS ALERT-BOX INFO BUTTONS OK.
    end method.

    method public integer fnBeheersgroep (input nr1 as integer, input nr2 as integer):
        return nr1.
    end method.

    CONSTRUCTOR myclass ( ):    
        main().
    END CONSTRUCTOR.

end class.

Using it as a function rather than a method gave me error 13664: Cannot invoke method '' in object of type '' using DYNAMIC-FUNCTION(). (13664)

Hope it helps.