検索

ディスカッション
· 19 hr 前

Cara Menghubungi Call Center Batik Air Indonesia

Anda dapat menghubungi Call Center Batik Air 0857-0991-7684, atau melalui WhatsApp Customer Support +62 857 0991 7684.

ディスカッション (0)1
続けるにはログインするか新規登録を行ってください
ディスカッション
· 19 hr 前

Cara Menghubungi CS Batik Air Indonesia

Anda bisa menghubungi layanan pelanggan Batik Air Indonesia melalui WhatsApp 62 857 0991 7684, atau melalui Call Center Batik Air 0857-0991-7684.

ディスカッション (0)1
続けるにはログインするか新規登録を行ってください
質問
· 2025年12月28日

Are class queries only for SELECT?

Hi developers!

There is a neat feature of ObjectScript classes - Query element, which allows you to write in a clear SQL (without any & or ()), pass parameters to it and call it from ObjectScript as do QueryNameFunc() or via Call SQLProcedureName via SQL, .e.g.

Query MyQuery(p as %String) as %SQLQuery [SQLProc]

{ 

SELECT * FROM MyTable 

WHERE Name=:p

}

All works fine, but when I tried to use the same for a DELETE statement see the following error:

SELECT expected, DELETE found ^ DECLARE Q1 CURSOR FOR DELETE

Is the Query element for SELECT only? What am I doing wrong? )

4件の新着コメント
ディスカッション (4)2
続けるにはログインするか新規登録を行ってください
記事
· 2025年12月28日 1m read

#DIM vs SET - Objectscript

SET assigns value to the variable at RUNTIME.

#DIM declare the variable and it's Data Type at COMPILE TIME.


SET #DIM
Makes the variables Dynamic. Improves Readability.
No Data Type Declaration. Enables IDE auto-completion.
Runtime Useful for Object references.

#DIM name As %String
Set name = "Micheal Scott"
#DIM age As %Numeric
Set age = 36
#DIM employer As App.Employer               ; compile time
Set employer = ##class(App.Employer).%New() ; runtime 

 

SET or #DIM? Your design, your rules.

4件の新着コメント
ディスカッション (4)2
続けるにはログインするか新規登録を行ってください
記事
· 2025年12月28日 3m read

embeddedpy-bridge: A Toolkit for Embedded Python

Embeddedpy-bridge: A Toolkit for Embedded Python

Overview

Embedded Python is a game-changer for InterSystems IRIS, offering access to the vast Python ecosystem directly within the database. However, bridging the gap between ObjectScript and Python can sometimes feel like translating between two different worlds.

To make this transition seamless using embeddedpy-bridge.

This package is a developer-centric utility kit designed to provide high-level ObjectScript wrappers, familiar syntax, and robust error handling for Embedded Python. It allows developers to interact with Python data structures using the native IRIS patterns they are already comfortable with.

The Challenge

While the %SYS.Python library is powerful, developers often face a few hurdles:

  1. Handling Proxies: Navigating Python lists and dictionaries using raw proxies doesn't feel "native" to ObjectScript.
  2. Iteration: Standard ObjectScript While loops don't natively "talk" to Python iterators.
  3. Namespace Management: Ensuring Python utilities are available system-wide.

The Solution: embeddedpy-bridge

My goal was to create a "Bridge" that makes Python feel like a first-class citizen in ObjectScript.

Key Features:

  • The py Prefix Convention: All methods in the %ZPython.Utils class use a py prefix (e.g., pyDict(), pyList(), pyJSON()) to clearly distinguish Python-related logic from native IRIS code.
  • OO Wrappers: High-level classes for List and Dict that support familiar methods like GetAt(), SetAt(), and Count().
  • Smart Iterators: Integrated ListIterator and DictIterator allow you to traverse Python data using standard ObjectScript While loops.
  • Macro Support: A %ZPython.inc file provides shortcuts like $$$pyDict and $$$pyJSON for cleaner, faster development.

Usage Examples

1. Simple Syntax (Macros)

No more typing ##class(...) every time. Use short shortcuts:

  • $$$pyDict — Create a Python Dictionary.
  • $$$pyList — Create a Python List.
  • $$$pyJSON(dynObj) — Turn a JSON object into Python instantly.

2. Unified Dictionary Handling

Instead of managing raw Python proxies, use the wrapped dictionary:

Code snippet:

Include %ZPython
Set pyDict = $$$pyDict
Do pyDict.SetAt("Status", "Active")
Do pyDict.SetAt("Version", 1.0)

// Standard IRIS iteration
Set iter = pyDict.%GetIterator()
While iter.%GetNext(.key, .val) {
    Write "Key: ", key, " Val: ", val, !
}

 

Set pyList = $$$zpyList()

Do pyList.Append("First Item")
Do pyList.Append("Second Item")

Write "Total items: ", pyList.Count(), !

// Access by index
Write "Item 1: ", pyList.GetAt(0), !

2. Seamless Data Conversion

Convert IRIS Dynamic Objects to Python objects and back with one line:

Code snippet

Set dynObj = {"name": "John", "roles": ["Admin", "User"]}
Set pyObj = $$$pyJSON(dynObj)

// Verify Python type
Write ##class(%ZPython.Utils).IsType(pyObj, "dict") // 1

The goal of this project is to bridge the gap between two powerful worlds. While InterSystems IRIS provides the engine for Embedded Python, embeddedpy-bridge provides the steering wheel. 

1件の新着コメント
ディスカッション (1)2
続けるにはログインするか新規登録を行ってください