run a method of my class?
Guys, I made an application, how can I run the methods in the terminal?
thanks.
Comments
Hello Vandrei,
Your question is a bit vague but hopefully this helps:
https://cedocs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GOBJ_methods
##class(Package.Class).Method(Args)
"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.
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.
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!