run a method of my class?

Primary tabs

Answers

If you want to execute a Method in the Terminal, you need to use the DO command  with the Method, program and parameters.

Ex. 

DO METHOD^PROGRAM --> Call one Method Without Parameters

DO METHOD^PROGRAM(PAR1,PAR2) --> Call one method with two paramaters.

DO METHOD^PROGRAM(PAR1,PAR2),METHOD^PROGRAM --> Call two Methods in the same command.
 

"Method of my class" though...

@Vandrei de Lima 

write ##class(Your.Class).YourMethod(arg1, arg2, arg3) // How many args you have.

As a follow up to this, if you're using the ##class(class name).myMethod(args) syntax and it's not working, it may be that you're trying to call an instance method, a method called on an object instance of your class, rather than a class method, a method called on the class itself.

In that case, you'd want to try something like:

set myObj = ##class(class name).%New()

do myObj.myMethod(args)

Hope this helps!