Vandrei de Lima · Sep 19, 2019

run a method of my class?


Guys, I made an application, how can I run the methods in the terminal?


3 0 4 359
Log in or sign up to continue


"Method of my class" though...

@Vandrei de Lima 

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

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


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.

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!