Get GLOBALS similar to “Global Search Mask” Intersystems Cache

南楼画角 提交于 2019-12-06 14:51:48

In this case you may use %Library.Global class with Get query. In this query you can pass exactly the same mask as a second argument, and will get global names and values as a result. in Cache such code may looks like:

Set Namespace = "USER"
Set mask = "^BACKTR(""DATA"",,)"
Set tRS = ##class(%ResultSet).%New("%Global:Get")
Set tSC = tRS.Execute(Namespace,Mask,"")
While tRS.Next() {
    Set gn = tRS.GetData(1)
    Set data = tRS.GetData(2)
}

And in VB something like this

    AxVisM1.P0 = "USER"
    AxVisM1.P1 = "^BACKTR(""DATA"",,)"

    AxVisM1.Execute("set tRS=##class(%ResultSet).%New(""%Global:Get"")")
    AxVisM1.Execute("set P3=tRS.Execute(P0,P1,"""")")
    If (AxVisM1.Error <> 0) Then
        MsgBox(AxVisM1.ErrorName)
        Exit Try
    End If

    AxVisM1.P2 = "0"
    While True
        AxVisM1.Execute("set P2=0,P3="",VALUE="" if tRS.Next() { set P2=1,P3=tRS.GetData(1),VALUE=tRS.GetData(2) } ")
        If (AxVisM1.Error <> 0) Then
            MsgBox(AxVisM1.ErrorName)
            Exit While
        End If
        If (AxVisM1.P2 = "0") Then
            Exit While
        End If

        ' AxVisM1.P3 - globalName
        ' AxVisM1.VALUE - data

    End While
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!