获取类似于“全局搜索掩码"的 GLOBALS;系统间缓存 [英] Get GLOBALS similar to "Global Search Mask" Intersystems Cache

查看:24
本文介绍了获取类似于“全局搜索掩码"的 GLOBALS;系统间缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在可以使用 VisM 通过 vb.net 执行系统间缓存对象脚本

I can use VisM now to execute Intersystem Cache Objectscript through vb.net

            'open the connection
        AxVisM1.Connect("CN_IPTCP:127.0.0.1[1972]")
        'set namespace to livedata (for formal namespaces, use the @ symbol)
        AxVisM1.NameSpace = "LIVEDATA"

        'okay, so kunin mo na si GLOBALS...
        'set value to nothing muna
        AxVisM1.VALUE = ""

        'next, get mo yung value via this syntax
        AxVisM1.Code = "Set VALUE=$GET(" & theGlobals & ")"


        'execute
        AxVisM1.ExecFlag = 1

        'close the connection
        AxVisM1.DeleteConnection()

        'now, pass the results to.. a textbox?

        Return AxVisM1.VALUE

您可以通过将对象脚本传递给 .CODE 来执行它

you can execute objectscript by passing it on .CODE

现在,是否有可以模仿系统间缓存中GLOBAL SEARCH MASK 功能的对象脚本?如下图所示

Now, is there an object script that I can use that can mimic the function of the GLOBAL SEARCH MASK in Intersystems Cache? like in the image below

编辑我尝试了以下将数据传递到我的数据表,但我的数据表没有任何内容

EDIT I tried the following to pass the data to my datatable, but my datatable is not having any content

Try
        'open the connection
        AxVisM1.Connect("CN_IPTCP:127.0.0.1[1972]")
        'set namespace to livedata (for formal namespaces, use the @ symbol)
        AxVisM1.NameSpace = "LIVEDATA"

        'okay, so kunin mo na si GLOBALS...
        AxVisM1.P1 = "^BACKTR(""INDX"",""COMPANY"",)"
        'set value to nothing muna
        AxVisM1.VALUE = ""

        ''next, get mo yung value via this syntax


        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

        'create the datatable

        Dim tbl As New DataTable
        tbl.Columns.Add("theGlobals")
        tbl.Columns.Add("theValz")

        'start the loop
        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) } ")
            AxVisM1.ExecFlag = 1

            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
            tbl.Rows.Add(AxVisM1.P3.ToString, AxVisM1.VALUE.ToString)


        End While
        'close the connection
        AxVisM1.DeleteConnection()


        'Return AxVisM1.VALUE
        Return tbl


    Catch ex As Exception

        'close the connection
        AxVisM1.DeleteConnection()

        MsgBox(ex.ToString)
        Return Nothing

    End Try

推荐答案

在这种情况下,您可以使用 %Library.Global 类与 Get查询.在此查询中,您可以传递与第二个参数完全相同的掩码,并且将获得全局名称和值作为结果.在缓存中这样的代码可能看起来像:

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)
}

在 VB 中是这样的

    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

这篇关于获取类似于“全局搜索掩码"的 GLOBALS;系统间缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆