It's useless on your local dev, but depending your goal :
You can try to dump

zzDumpDoc(pkg, targetDir="c:\dev\testdumpdoc\")
    new (pkg, targetDir)

    Do:'##class(%File).DirectoryExists(targetDir) ##class(%File).CreateDirectoryChain(targetDir)

    Set pkgDot = pkg _ ".", class = pkgDot, restore = 0

    If $Isobject($Get(%request)) {
        Set oldRequest = %request
        Set oldResponse = %response
        Set oldSession = %session
        Set restore = 1

    }

    Set %request = ##class(%CSP.Request).%New()
    Set %response = ##class(%CSP.Response).%New()
    Set %session = ##class(%CSP.Session).%New("0123456789")
    Do %session.Unlock()

    Set %request.Data("PAGE",1) = "CLASS"

    For  {
        Set class = $Order(^oddDEF(class))
        Quit:$e(class,1,$l(pkgDot))'=pkgDot
        Set %request.Data("LIBRARY",1) = $namespace
        Set %request.Data("CLASSNAME",1) = class

        Set initialIO = $IO
        Set file = targetDir_class_".html"
        OPEN file:("NRW"):2
        USE file
        Do ##class(%CSP.Documatic.PrintClass).OnPage()
        USE initialIO
        CLOSE file
    }

    If restore {
        Set %request = oldRequest
        Set %response = oldResponse
        Set %session = oldSession
    }
    quit

There exits more elegant way to redirect the output (check the community).

Hello @Evgeny Shvarov ,

I tested the following code in an Iris terminal to add %DB_%DEFAULT role, It seems to work :

Write !,"Current user roles : ",$Roles
Zn "%SYS"
Set tSc = ##class(Security.Applications).Get("/csp/user",.p)
Write !,"Get application : ",$SYSTEM.Status.GetOneErrorText(tSc)
Set p("MatchRoles")=p("MatchRoles")_":%DB_%DEFAULT"
Set tSc = ##class(Security.Applications).Modify("/csp/user",.p)
Write !,"Modify application : ",$SYSTEM.Status.GetOneErrorText(tSc)
Kill p

Hello @Dmitry Maslennikov ,

I've modified a 'legacy method' in order to implement a timeout.

May be the following code could help you : 

/// Run a command line<BR/>
/// Echos of command are stored in result argument <br/>
/// Return 0 if a timeout occurs.
ClassMethod runCmdWithTimeout(
command As %String,
ByRef result As %Binary,
timeout As %Integer) As %Boolean
{
end = $zh+timeout, timeout = 0
    a=$zu(69,40) $et $et="s a=$zu(68,40,"_a_")" 
    command:"qr" a=$zu(68,40,1)
    command i=1:1 line:1 s:line'="" result(i)=line s:$zh>end timeout=1 q:$zeof||timeout
    command
    $et
    'timeout
}

Hello @Rodolfo Moreira,

For retrieve the task ID, I wrote this : 

ClassMethod getTaskId(
    ByRef sc As %Status = {$$$OK},
    className As %String = {..%ClassName(1)}) As %String
{
    Set id = ""
    Set rs = ##class(%Library.ResultSet).%New("%SYS.Task:TaskListDetail")
    Set sc = rs.Execute()
    Quit:$$$ISERR(sc) ""
    While (rs.Next(.sc)) {
        Quit:$$$ISERR(sc)
        if (rs.Get("TaskClass")=className){
            Set id = rs.Get("ID")
            Quit
        }
    }
    Quit id
} 

Hope this help you.

Regards.

Edit : modify this code for your needs (ex : return a list of Id, namespace filter...)

Hello Eduard,

For debug purpose , you can try this :

Set obj = {Your test.ABC instance}

Set res = ##class(%Studio.General).DumpObjectFunc(obj)

While res.%Next() { Write !,"Property : ",res.%Get("Name"), !," Value : ",res.%Get("Value") }

Or just perform a zw obj

Regards.

Lorenzo.

EDIT : I tested with ##class(%Studio.General).DumpObjectFunc(obj)

We can get value if "myProp" is not an object.

Hello,

We are using this procedure in order to reduce the dowtime during software update. 

In short :

  • Create a temp namespace. 
  • import and compile code.
  • stopping application.
  • switch DB code on target namespace.
  • Execute a script for data update (if needed).
  • starting application.

It work fine for Caché.

Coming soon, we will do that for production with HealthShare Health connect.

It should be work fine also for a production, but  I don't done a test yet.

If you have a translate file, don't forget import your traductions because ^CacheMsg and ^CacheMsgNames are in CODE database.

Regards.

Hello,

I think, you should simply append your own error message like that : 

Set obj = ##class(User.tApplications).%OpenId(YourTApplicationId,"4",.errors)
Set:$$$ISERR(errors) errors = $$$ADDSC(errors,$$$ERROR($$$GeneralError,$$$FormatText("%OpenId failed for User.tApplications with id %1",YourTApplicationId)))

If an error occurs, variable "errors" will contain 2 errors.

NS>d $System.Status.DecomposeStatus(error,.b)
 
NS>zw b

Your error is in the subscript b(2).

Add  #include %occStatus if you are in a routine (for macro usage).

Regards.