検索

Discussão
· Ago. 25

Summer 2025 with Global Masters

Summer is coming to an end, and we’re sure you had plenty of highlights! ✨

Maybe you learned something valuable, got yourself a reward on Global Masters, or even joined READY 2025 🎉

Here’s a quick checklist — but you can, of course, share anything else about your summer in the comments. Photos are more than welcome 📸

  • Went to the sea or a lake
  • Hiked/enjoyed nature
  • Traveled somewhere new
  • Attended a concert or festival
  • Watched a movie or series
  • Read a book
  • Earned points and redeemed a reward on Global Masters 🏆
  • Joined READY 2025 🎉
  • Spent time with family or friends

We hope your summer was amazing — can’t wait to see your stories, and photos, if you’d like to share — we start first! 🌟



P.S. Your comment will be awarded with 30 points on Global Masters automatically.

40 Comments
Discussão (40)18
Entre ou crie uma conta para continuar
Resumo
· Ago. 25

Publicações Desenvolvedores InterSystems, Agosto 18 - 24, 2025, Resumo

Agosto 18 - 24, 2025Week at a GlanceInterSystems Developer Community
Anúncio
· Ago. 25

Developing with InterSystems Objects and SQL – In Person September 15-19, 2025 / Registration space available

Developing with InterSystems Objects and SQL – In Person September 15-19, 2025

  • This 5-day course teaches programmers how to use the tools and techniques within the InterSystems® development environment.
  • Students develop a database application using object-oriented design, building different types of IRIS classes.
    • They learn how to store and retrieve data using Objects or SQL, and decide which approach is best for different use cases.
    • They write code using ObjectScript, Python, and SQL, with most exercises offering the choice between ObjectScript and Python, and some exercises requiring a specific language.
  • This course is applicable for users of InterSystems IRIS® data platform and InterSystems Caché®
  • Self-Register Here
Discussão (0)1
Entre ou crie uma conta para continuar
Pergunta
· Ago. 25

Catching WorkQueue Errors

I'm trying to catch some WorkQueue errors that are happening on 2019 but not on more recent versions.

I'm getting an error when trying to call a class method via a workQueue. It functions properly in 2024.1. When calling the method, it immediately errors. I have logging at the top of the method that never gets set. 

The error being returned by Iris is simply an "ERROR #5039: An error occurred while calling function  s %sc=##class(|"NS"|Path.To.Class).ClassMethod(.%p1,.%p2)"

The parameter counts match and are appropriate for the method.

When I catch the full stack, it's erroring on the WorkQueue compiled routine, somewhere around startWork+233^%WorkQueueMgr. The error stack mentions a few lines, all in startWork. Looking at what, I think is, the associated inc file (occWorkQueue.inc), there's some mention of turning on logging by setting ^%SYS("WQM","EnableWorkLogging"). If that's true, it will set the error being passed in into the ^%ISCLOG global. However, even when I do set ^%SYS("WQM","EnableWorkLogging") to 1, and ^ISCLOG to 4 (or higher), I never see the logs I'd expect to. I know there are logs within the routine that set values and errors to $$$WorkSysLog at levels 2 and 3, so setting ^ISCLOG to 4 should catch those errors. 

How can I view the errors being thrown by the compiled routine? Does the value of "EnableWorkLogging" only matter at some stage I can't set? 

7 Comments
Discussão (7)3
Entre ou crie uma conta para continuar
Artigo
· Ago. 25 3min de leitura

Programação Prática em ObjectScript: De JSON a Globals e a SQL

Ao começar a usar o InterSystems IRIS ou Cache, os desenvolvedores frequentemente se deparam com três conceitos principais: Objetos Dinâmicos, Globals e Tabela Relacional. Cada um tem seu papel na construção de soluções escaláveis e fáceis de manter. Neste artigo, vamos percorrer exemplos de código práticos, destacar as melhores práticas e mostrar como esses conceitos se conectam.

1. Trabalhando com Objetos Dinâmicos

Objetos dinâmicos (%DynamicObject e %DynamicArray) permitem que os desenvolvedores manipulem estruturas semelhantes a JSON diretamente no ObjectScript. Eles são especialmente úteis para aplicações modernas que precisam analisar, transformar ou gerar JSON.

Exemplo: Criando e Manipulando Objetos Dinâmicos

    // Create a Dynamic object
    Set obj - {}

    // Add properties
    Set obj.name = "Vachan"
    Set obj.age = 25
    // Nested objects
    Set obj.address = {"city":"Bengaluru", "zip":"560000"}
    
    // Add an Array
    Set obj.skills = ["Objectscript", "SQL"]
    
    // Convert to JSON string
    Set json = obj.%ToJSON()
    Write json,!
    
    // Parse JSON string back to an object
    Set parser = {}.%FromJSON(json)
    Write parser.name

Melhores Práticas

  • Sempre valide a entrada JSON com %FromJSON() para capturar erros.
  • Use obj.%Get("property") quando não tiver certeza se uma propriedade existe.
  • Prefira %DynamicArray para estruturas do tipo lista..

2. Usando Globals de forma Eficaz

Globals são arrays esparsos hierárquicos armazenados diretamente no motor de banco de dados do IRIS. Eles são extremamente rápidos e podem armazenar praticamente qualquer estrutura.

Exemplo: Armazenando Dados em Globals

// Store student data in a global
SET ^Student(1,"Name") = "Alice"
SET ^Student(1,"Age") = 29
SET ^Student(2,"Name") = "Bob"
SET ^Student(2,"Age") = 34
// Retrieve data
WRITE ^Student(1,"Name")  // outputs: Alice
// Iterate over all students
SET id=""
FOR  SET id=$ORDER(^Student(id)) QUIT:id=""  {
    WRITE "Student ",id,": ",^Student(id,"Name")," (Age ",^Student(id,"Age"),")",!
}

Melhores Práticas:

  • Defina uma estrutura global clara antes de codificar (evite chaves ad hoc).
  • Use globals para armazenamento de alto desempenho quando o overhead do SQL não for necessário.
  • Para dados de aplicação, prefira classes persistentes com globals gerenciados internamente

3. Criando Tabelas SQL Relacionais

No IRIS, tabelas relacionais podem ser criadas usando DDL SQL e classes persistentes.

Exemplo: Criando uma Tabela SQL via DDL

CREATE TABLE Employee (
    ID SERIAL PRIMARY KEY,
    Name VARCHAR(50),
    Age INT,
    Department VARCHAR(50)
);

Exemplo: Criando a mesma tabela como uma Classe Persistente

Class Company.Employee Extends (%Persistent) {
    Property Name As %String(MAXLEN=50);
    Property Age As %Integer;
    Property Department As %String(MAXLEN=50);
}

Uma vez compilada, esta classe cria automaticamente um global subjacente e uma tabela SQL. Agora você pode usar tanto o ObjectScript quanto o SQL:

// Create and save an employee
SET emp = ##class(Company.Employee).%New()
SET emp.Name = "Charlie"
SET emp.Age = 40
SET emp.Department = "IT"
DO emp.%Save()

// Query employees with SQL
&sql(SELECT Name, Age FROM Company.Employee)
WHILE (SQLCODE=0) {
    WRITE "Employee: ",Name,", Age: ",Age,!
    FETCH NEXT
}

Melhores Práticas:

  • Prefira classes persistentes para aplicações fáceis de manter.
  • Use DDL SQL para definições rápidas de tabelas ou integração com sistemas externos.
  • Sempre defina índices para propriedades frequentemente consultadas.

 

RESUMO:

Seja para analisar payloads JSON, gerenciar dados de consulta de alta velocidade ou projetar tabelas relacionais, entender quando usar objetos dinâmicos, globals ou classes persistentes é fundamental para se tornar um desenvolvedor ObjectScript eficaz.

Discussão (0)1
Entre ou crie uma conta para continuar