#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 Lucas Scarduelli · Jun 14, 2017

Hi,

I only use Caché and CSP, I am making a simple request in CSP page with #call method, and I have to define a callback of this #call method, can I do this?

This is my simple request in CSP page (javascript):

            PainelBordoResource.prototype.obterIndicador = function(requisicaoParametros) {
                let retorno = #call(painelbordo.PainelBordoResource.obterIndicador(angular.toJson(requisicaoParametros)))#;
                return retorno;
            };
 

1
0 519
Question Rubens Silva · Jun 12, 2017

Here's my issue. I've been using Sample.* globals and packages mapped to another development namespace to realize unit tests. So when I ran it, I notice that I forgot to start a transaction in order to be able rollback it to it's original data.
I assumed that I should use transactions since I was manipulating it's data but I didn't want it to be persisted.

1
0 427
Question Scott Roth · Jun 9, 2017

I have a case where I am creating a PDF file from an Encoded String, and I need to transfer this file over to another server. I was wondering since this is PDF file if I could just invoke the FTP.OutboundAdapter within my Object script that is creating the PDF from the encoded string. Is this possible? Does anyone have an examples of using EnsLib.FTP.OutboundAdpater within their Object Script?

Thanks

Scott Roth

Integration - Interfaces

The Ohio State University Wexner Medical Center

5
0 672
Question Evgeny Shvarov · Jun 9, 2017

Hi, Community!

Suppose I have class A with properties P1 and P2.

I want to introduce class B, which would have same records as Class A, but only  one property - P2.

What is the easiest  way to manage it assuming that I would like to use Class A to add records and be available for any operations to Users with Role A.

And I would like to introduce class B for Users with role B for read-only access.  Preferably they shouldn't even be aware of Class A and P1 existence .

What is the easiest way to introduce it and manage it?

Use some proxy-classes?  Property-level security?

10
0 812
Question Khalid Saleem · Jun 2, 2017

Hi,

I am trying to generate a custom error-code using the following code

Class ISG.CommonBilling.Service.Test1 Extends EnsLib.HL7.Operation.TCPOperation
{
	ClassMethod khalid() As %Status
	{
		Set tSC=$$$ERROR("10001","I am here")
		write $$$GETERRORCODE(tSC)_$char(13,10)
		write $SYSTEM.Status.GetErrorText(tSC)
	}
}

And here is the output:

KINDRED>do ##class(ISG.CommonBilling.Service.Test1).khalid()
10001
ERROR #10001: Unknown status code: 10001 (I am here)

QUERY: Is there any way I can remove the part "Unknown status code: 10001 (...)" in the error-text?

Thanks in advance, Khalid

5
0 1475
Question Ankita JAin · May 31, 2017

Is there any methods/ways through which will get to know whether any of the Unit Test cases is/are failing in the Terminal with status as either 0 or False in case of Failure & 1 or Ture in case of Test Passes (we are getting an url of the csp page with the report which has the passed failed status) as we need to send this failure status to Jenkins for the Build to Fail (where in we have acheived this part in making the build failure/success based on  harcoded boolean)

2
0 775
Question Evgeny Shvarov · May 26, 2017

Hi!

I'm saving object instance using RestForms.

RESTFormsUI calls %Save() for me, which is great. But I want to set the property CreationDate with the current date for every new record being inserted.

So  object callback implementation seems as a reasonable option. I did the following:

Method %OnBeforeSave(insert as %Boolean) As %Status [ Private, ServerOnly = 1 ] 
{

 if insert s ..CreationDate=$H

 q $$$OK

}

And it works fine.

But Documentation says I'd better use %OnAddToSaveSet()

What are you using for the callbacks in similar cases?

15
0 1071
Question Rubens Silva · May 12, 2017

Hello.
I would like to know if there's a way to batch a certain amount of writes done inside a job and display it sequentially on the main process.
My idea is to prevent the main process from freezing while displaying the batched data. The main process's device could be

the terminal or the Studio output.

%Studio.Debugger does something close to that when printing the output from the debug target process.
$System.Event.Signal($zparent) doesn't signals the parent if a device is open. So I can't create the batch buffer along, because I can keep the buffering device open and notify the main process.

11
0 754
Question Laura Cavanaugh · May 12, 2017

I was looking at the OrefToArray^%occRun in the %CSP.ErrorLog page in version 2016.  However, we're on version 2014, and that method does not seem to exist yet.  I would love a good way to swizzle out the info in the %request, %session, %response objects for the error log for my own error page, in version 2014.  I don't want to have to go through and get all the properties manually, but I will if I must.  Any other good way  already written?

Thanks,

Laura

9
1 639
Question Alex Kogan · May 12, 2017

Hello All,

I have a question / issue regarding the calling list.FindOref(<object from indexOpen call>)
Here is a simple way to reproduce the issue: 
2 classes: Utility.contacttypes and Utility.person
*************************

Class Utility.contacttypes Extends %Persistent
{
Property description As %Library.String(TRUNCATE = 1);
/// Index for property description
Index descriptionIndex On description [ Unique ];
}

*************************

5
0 420
Question Nigel Salm · Apr 28, 2017

Hi

I have an Ensemble Application with many classes and relationships between those classes.

I need a tool that can connect to Cache/Ensemble and create a visual ERD from the class definitions within a particular Cache Namespace

MS-Access is one option but it does not automatically create the relationship connectors between classes

Any suggestions

Nigel Salm

6
0 5505
Question Stella Ticker · Apr 21, 2017

I am using a %Stream.FileCharacter object  and LinkToFile API to write to a file on a folder. The file is written line by line . Something like  below:-

Set tStream =   ##class(%Stream.FileCharacter).%New()

Set tStatus =tStream.LinkToFile("MyFileName")

For i=1:1:X  { Set result = ..process(i) Do tSream.WriteLine(result) }

1
0 1101
Question Susobhan Pandit · Apr 20, 2017

I am working in Cache Objectscript where I need to process around 0.2 million data.

I am executing SQL query through "%Library.ResultSet"

Code Example:

Set tsRSet=##class(%Library.ResultSet).%New("<query name>")
Set status = tsRSet.Execute(<param 1>,<param2>)
While tsRSet.Next()
{
     Business Logic
}

Is there any limitation of the above code when the number of records the query is fetching is high.

If the query returns 0.5 million to 1 million record will my code work properly or it may break due to high volume of data.

I have 4 GB RAM and 2 GB global buffer in my production system.

4
0 552
Question Everardo Cunha · Apr 19, 2017

I wonder if you could help me? I have a regular cache class that accepts a variable number of arguments in one of the methods. It works fine so I decided to add a method to my web service to make the call to the cache class. I get a compile error on the web service with error#5130.

Here is the cache class

class method GenerateFileFromSQL(file As %String, sql As %String, delimiter As %String = "", args...) As %Status

and here is the web service code that calls it:

ClassMethod GenerateFileFromSQL(file As %String, sql As %String, delimiter As %String = "", args...) As %String [ WebMethod ]
 

2
0 933
Question Scott Roth · Apr 19, 2017

Awhile back we had someone write some code to Log messages like we did in eGate but with Ensemble.

ClassMethod LogIt(pComponent As %String, pMsgIn As %String)
{
 set vDIR="/ensemble/"_^OSUWMCInstance_"/logs/"
 set fs=##class(%Stream.FileCharacter).%New()
 set fs.Filename=vDIR_pComponent_".log"
 do fs.MoveToEnd()
 set vTM=$PIECE($ZDATETIME($HOROLOG)," ",2)
 //$ZTIME($PIECE($H,",",2),1)
 do fs.WriteLine(vTM_" : "_pMsgIn)
 do fs.%Save()
 set fs = "" // Close file
}

2
0 1497