#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

3
1 1193
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.

9
0 755
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

2
0 633
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. If anyone out there has had experience on this please advice all I need to do is be able to invoke my jar file within Cache(In general want to call my  java programme  within Cache

2
0 618
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:

3
0 369
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 ().

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?

1
0 372
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?

7
5 889
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 1800
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

6
0 3356
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:

18
1 1704
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 1233
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 3509