#Object Data Model

4 Followers · 498 Posts

An object data model is that data or code is composed of modules that combine data and procedures that work on the data.

Learn more.

Question Gaolai Peng · Nov 8, 2018

I am trying to get SDA3.Container object from a Stream object like following code:

Method HandleECRUpdateRequest(pRequest As CUSTOM.CORE.Message.ECRUpdateRequest, ByRef pResponse As Ens.Response) As %Status
{

               Set tContainer=##Class(HS.SDA3.Container).%New()
               $$$ThrowOnError(tContainer.InitializeXMLParse(pRequest.ContentStream, "SDA3"))
              
               Set tEventDescription=tContainer.EventDescription

But it tContainer seems to be empty.The tEventDescription is set to empty.

3
1 1200
Question Jeffrey Drumm · Apr 16, 2023

When an object is created in memory, the object reference (OREF) is represented as a string value when displayed with the Write command:

HICG>Set pat=##class(JD.Sample.patient).%OpenId(70)
HICG>Write pat
1@JD.Sample.patient ; "stringified" OREF
HICG>Zwrite pat
pat=1@JD.Sample.patient  ; <OREF>
+----------------- general information ---------------
|      oref value: 1
|      class name: JD.Sample.patient
|           %%OID: $lb("70","JD.Sample.patient")
| reference count: 2
+----------------- attribute values ------------------
|       %Concurrency = 1  <Set>
|            address = "
14
1 698
Question Iryna Mykhailova · Nov 9, 2022

Hi guys!

My student asked my why his unit tests don't work as they should, and I just could answer him. Here is the simplified case.

There is a class with a required unique property Name:

Class Test.NewClass [ Abstract ]
{
Property Name As%String [ Required ];
Index NameIndex On Name [ Unique ];
}

And there is an inherited class:

Class Test.NewClass1 Extends (%Persistent, Test.NewClass)
{
}

What I expect to happen, is when I save two objects of class Test.NewClass1 with the same value of property Name, for the second one to get an error stating that it violates the unique index.

set a = ##cla
9
0 758
Question Oleksandr Demchenko · Nov 18, 2022

Hi, how do I create a trigger that will only set the value of the "Status" field for new objects, not for all available?

Class CarDealer.Order Extends (%Persistent, %Populate)
{

 Property Title As %String

 Property Status As %String(VALUELIST = ",InProgress,Done,Canceled");

Trigger setStatus [ Event = INSERT, Foreach = row/object, Time = AFTER ]
{
 &sql(update CarDealer.Order set Status = 'InProgress')
}

2
0 574
Question Smythe Smythee · Nov 16, 2022

Hi,

I

want to get the values from a serial property because my code depends upon the class serial class.

For example

Serial class

Class Data.Serial Extends %SerialObject

{

Property FirstName as %String;

Property LastName as %String;

}

Persistent class

Class Data.Persistent Extends %Persistent

{

Property MPID as %Integer;

Property Name as Name.Serial;

}

Now i need save MPID and Name(Serial class property into SQL Table ) so i am trying the below class

Class Data.TestUtil Extends %RegisteredObject

{

Method Savedata(MPID,FirstName,LastName)

{

Set tSC=0

Set Obj=##Class(Data.Persistent).%New()

Set Obj.MPID=MPID

Set

2
0 634
Question Thembelani Mlalazi · Sep 24, 2018

I am trying to work with Java Selenium through Cache  my java programme works fine but I would like to pass parameters to the jar file form my Ensemble production. I followed this Tutorial here, For starters I wanted to copy it as it is and run that as an example but the (Stateless Service Mode Example) is not working within my eclipse environment with errors on the com.intersys.complaining about the service class.

2
0 622
Question Laura Cavanaugh · Oct 26, 2022

Hello all; I am using a one-to-many relationship.  I have a Claim (one), in a relationship with Lines (many), but the Claim is storing a list of Lines IDs, rather than the Lines storing the Claim Id.  This seems upside down, and not what I expected.

Class Claim

{
    Relationship ClaimLineRel as ClaimLine [Cardinality = many, Inverse = Claim];
}

Class ClaimLine
{
    Relationship Claim as Claim [ Cardinality = one, Inverse = ClaimLineRel, OnDelete = cascade];
    Index ClaimIndex on Claim;
}

But the storage globals for Claim show data in the ClaimLine spot:

^ClaimD(1)=$lb("",$lb(2,3).

3
0 371
Article Timothy Leavitt · Jan 21, 2022 7m read

@Ming Zhou asked a great question in https://community.intersystems.com/post/how-get-all-properties-defined-… and the answer sums up exactly why ObjectScript is my favorite.

When I'm first describing ObjectScript or IRIS to someone I always explain that you can write a class, compile it, get a table, and work with your data from an object or relational perspective - whichever is most natural.

11
6 2286
Question Joseph Tsang · Jun 27, 2022

Has anyone here been successfully populating a %Persistent object from calling %LoadFromMemory() with a temp. global?

I have tried using Sample.Person in the SAMPLES namespace. It worked EXCEPT that I have no way to set the id into that Sample.Person objec.

SAMPLES>Merge array(1) = ^Sample.PersonD(1)
 
SAMPLES>Set obj = ##class(Sample.Person).%LoadFromMemory(1,.array)
 
SAMPLES>zw obj
obj=1@Sample.Person  ; <OREF>
+----------------- general information ---------------
|      oref value: 1
|      class name: Sample.Person
| reference count: 2
+----------------- attribute values
1
0 263
Question Ivan Myasnikov · Jan 21, 2019

Good day.

The issue is related to Cache Studio. I wrote a plugin for creating reports using FastReport. The plugin is called via the context menu. In this case, the class is   d ## (%ZFastReport.SourceControl) .InstallSorceControllAllNameSpace ().

RunContextMenu

Example:  https://github.com/MyasnikovIA/CacheFastReport 

1) Tell me please, can I create a context menu for calling a program, without using a version control system?

2) How to determine the local location of the CStudio.exe file on the client side? The plugin is located on the client in the BIN directory. ^%SYS("bindir") is not suitable, because

1
0 374
Question anas lamaizi · Nov 14, 2018

Hello

Is there anyone who can convert this code From PHP TO CACHE in File (.mac)?

this is my function is empty :/ 
thank you all

<?php
$output_dir = "uploads/";
if(isset($_FILES["myfile"]))
{
    $ret = array();
    
//    This is for custom errors;    
/*    $custom_error= array();
    $custom_error['jquery-upload-file-error']="File already exists";
    echo json_encode($custom_error);
    die();
*/
    $error =$_FILES["myfile"]["error"];
    //You need to handle  both cases
    //If Any browser does not support serializing of multiple files using FormData() 
    if(!is_array($_FILES["myfile"]["name"]))
1
0 587
Question Tuan nguyen · Sep 13, 2018

I can refer to the TracerName for a given ImageFile object with the following syntax: obj.Study.Injection.GetAt(obj.InjKey).RadioTracer.TracerName

Is it possible to write an SQL statement to search the PET.ImageFile table to find a match based on the RadioTracer.TracerName?

1
0 279
Article Vivian Lee · Dec 15, 2021 3m read

Setting the Scene

I was editing the properties of a persistent ObjectScript class the other day and noticed that the storage definition wasn't updating to reflect my latest changes.

In this case, I deleted a property that was no longer needed from the class definition, saved, recompiled, and still saw it in the storage definition.

No problem, I thought. If the storage definition gets autogenerated on compile, I can just delete it and recompile the class. Sure enough, after doing this, I no longer saw the deleted property in the storage definition.

There, problem solved... right?

(cue wrong answer

7
5 892
Article Joel Solon · Dec 23, 2015 1m read

In the Caché Foundations course, students are learning about Caché Development and ObjectScript syntax at the same time. To help students complete the exercises, we provide an ObjectScript Quick Reference (aka "the Cheat Sheet").

It is not a reference for all of ObjectScript! It is a list of the ObjectScript commands and functions that students use during the course, along with common syntax for objects, collections, etc. It also contains some useful macros.

We are providing a pdf version to the Developer Community.

6
0 1802
Question reach.gr G · Aug 4, 2021

Trackcare 2021.2

Please may I know  how to access SQL parameter with string as datatype with NO reference to SQL Table and SQL Column.

Hi Experts,

I have these two clarifications to make:

  1. I am struggling to understand the process and method of accessing the SQL table with no reference to SQL parameter or Table but string

This is what I tried: Tired to create ERD diagrams and try to extract Primary and Foreign keys to associate, but I cannot in this case

I would like to do something like this

LEFT JOIN SQLUser.CT_Loc CTL ON CTL.CTLOC_Desc = ??
6
0 3360
Article Yuri Marx · Feb 23, 2021 2m read

I'm participating in the Developing with InterSystems Objects and SQL with Joel Solon. The course is very nice and I will share with you some tips I got during the training. Tips presented in the day 1:

  1. InterSystems IRIS unifies: InterSystems IRIS Database (Caché), IRIS Interoperability (Ensemble), IRIS Business Intelligence (DeepSee) and IRIS Text Analytics (iKnow).
  2. IRIS is multimodel: object, relational, document and multidimensional.
  3. Interoperable: native access from Java, .NET, other languages, like ObjectScript; ODBC and JDBC data access, SOAP/REST service access; message driven with
9
4 1000
Article John Murray · Mar 3, 2016 2m read

The purpose of this post is to raise the profile of a powerful mechanism that has long been available to us, and to open a discussion about ways in which it can be used or abused.

You can read more detail about the mechanism here. To summarize, your class definition can use the Projection keyword to reference one or more projection classes. A projection class can implement methods that get invoked at key points in the lifecycle of your class.

A projection class must extend %Projection.AbstractProjection and will typically implement at least one or the following methods:

  • CreateProjection
  • Remove
18
1 1708
Article Dmitrii Kuznetsov · Feb 15, 2021 17m read

A concurrent session in IRIS:
SQL, Objects, REST, and GraphQL
 

Kazimir Malevich, "Athletes" (1932)
 

"But of course you don't understand! How can a person who has always traveled in a horse-drawn carriage understand the feelings and impressions of the express traveler or the pilot in the air?"

Kazimir Malevich (1916)

Introduction

We’ve already addressed the topic of why object/type representation is superior to SQL for implementing subject area models. And those conclusions and facts are as true now as they have ever been. So why should we take a step back and discuss technologies that drag abstractions back to the global level, where they had been in the pre-object and pre-type era? Why should we encourage the use of spaghetti code, which results in bugs that are hard to track down, and which relies only on virtuoso developer skills? 

There are several arguments in favor of transmitting data via SQL/REST/GraphQL-based APIs as opposed to representing them as types/objects:

2
4 1240
Article Eduard Lebedyuk · Mar 24, 2017 9m read

In my previous article, we reviewed possible use-cases for macros, so let’s now proceed to a more comprehensive example of macros usability. In this article we will design and build a logging system.

Logging system

Logging system is a useful tool for monitoring the work of an application that saves a lot of time during debugging and monitoring. Our system would consist of two parts:

  • Storage class (for log records)
  • Set of macros that automatically add a new record to the log
6
10 3514
Article Yuri Marx · Mar 1, 2021 3m read

I'm participating in the Developing with InterSystems Objects and SQL with Joel Solon. The course is very nice and I will share with you some tips I got during the training. Tips presented in the day 4:

  1. All data are stored in Globals and Global names start with ^. Example of global: ^animal. Global can have multiples locations to the data ("sub data"). Example: ^animal(1).
  2. ^%* globals are accessible from any system-wide (from any namespace).
  3. Globals enables IRIS to support multimodel data (object, relational, document, multidimensional, etc).
  4. To see globals go the Management Portal >
12
2 655
Article Yuri Marx · Feb 25, 2021 3m read

I'm participating in the Developing with InterSystems Objects and SQL with Joel Solon. The course is very nice and I will share with you some tips I got during the training. Tips presented in the day 3:

  1. You can see your class catalog using %Dictionary classes and see your sql objects into INFORMATION_SCHEMA table.
  2. Is possible use SQL inside your ObjectScript methods using Dynamic SQL or Embedded SQL.
  3. You can pass parameters into Dynamic SQL string using ? (eg.: where country = ?) and pass parameters to Embedded SQL using colon (ed.: where country = :variable).
  4. Dynamic SQL Sample (from
2
3 733
Article Yuri Marx · Feb 24, 2021 3m read

I'm participating in the Developing with InterSystems Objects and SQL with Joel Solon. The course is very nice and I will share with you some tips I got during the training. Tips presented in the day 2:

  1. You can create persistent classes (classes with a correspondent table in the database to persist class properties).
  2. An Persistent class example:
    Class dc.Person extends (%Persistent)
    {
        Property Name As %String;
        Property BirthDate As %Date;
    }
  3. When you extends %Persistent, you get %New() to create a new instance in the memory, %Save() to save in the database and %Id() to get
4
3 811