Hi, folks!
There is an interesting discussion in the neighboring topic which raises a question for me: is there any reason to have %Status as a return value for COS method?
InterSystems ObjectScript is a scripting language to operate with data using any data model of InterSystems Data Platform (Objects, Relational, Key-Value, Document, Globals) and to develop business logic for serverside applications on InterSystems Data Platform.
Hi, folks!
There is an interesting discussion in the neighboring topic which raises a question for me: is there any reason to have %Status as a return value for COS method?
Major difference between GOTO and do command?
In reviewing the documentation found here, it states that there is an Attributes property. Since this is an array, I was wondering how I would go about traversing through the array to review what attributes are available on the file.
I am running a ZBREAK trace on a legacy FDBMS application that uses arrays but rather than displaying the array value contents, I am seeing logs similar to the following.
Trace: ZBREAK SET LINE=Array Val at BIOPWR+6^BIOPWR
My ZBREAK trace settings are as follows:
ZBREAK /TRACE:ON:"/somedir/trace1.log"
ZBREAK *LINE:"T"
Hi community,
I have some constants hardcoded in my class as parameter values, and those constants are referenced in many places in my module. Now the need has arisen to provide different value for those parameters depending on some context. Is it possible to create some sort of accessor method for the parameter (like it is possible for properties), or do I need to perform a thorough refactoring?
Thanks.
Jiri
Hi,
How can I read the stack of another process?
I know about ^JOBEXAM, but I only know how to use through terminal, and I need to get a string, or at least do a method that returns me a string
For example:
I have process A and B
B monitors process A at each second.
B logs information about process A in a table
Informations about lock I get through %SYS.LockQuery and the process through %SYS.Process
How can I get stack of process A from process B to log in the table?
Cache 2015.2.1
Thanks
Good day,
I would like to know how to detect in Caché ObjectScript if data saved in string is number and furthermore, if it's type is integer.
I maybe found a solution:
set value = "44.2d3"
try{
set status = $INUMBER(value,"")
if ('$FIND(+value,".")){
w "your variable: '"_value_"' is number and integer"
}else{
w "variable is number but no integer"
}
}catch(e){
w "variable is not number"
}
But I don't know how to do it correctly or if there exist better solution in COS (or maybe my solution is incorrect).
Thanks in advance for answers.
Hi, folks!
Suppose I have a CSP app, which provides some service.
And the code of my App knows the name of the CSP App in form: /myappname
How can I programmatically obtain the URL for CSP apps to send the full qualified link to the users(e.g. via email) of my app?
In this article I would like to tell you about macros in InterSystems Caché. A macro is a symbolic name that is replaced with a set of instructions during compilation. A macro can “unfold” in various instruction sets each time it is called, depending on the parameters passed to it and activated scenarios. This can be both static code and the result of ObjectScript execution. Let's take a look at how you can use them in your application.
What is a major difference between $case and $select?
Hi,
I have a situation where I write a character stream to a file. The file content gets signed and the signature is sent to a service provider together with the file content.
The signing is done using openssl.
This works perfectly on a dev PC, which is runnning Windows and has a little-endian architecture.
The problem is as soon as I do this on the server, which has a big-endian architecture, the signed value is incorrect according to the service provider.
The content is signed using RSA SHA256 with PSS padding.
I've had a look at $nconvert, $sconvert, etc., but can't get to a solution.
It is my understanding that when a routine accesses a global it is temporarily stored in global memory. While the global is within global memory, any other routine would be able to readily access the global from memory and not from disk so long as the same node is being utilized.
For example, RoutineB() would be able to access ^Global(1) and ^Global(1,2) since RoutineA() utilized them, but RoutineB() would have to read ^Global(1,7) from disk as it was not utilized by RoutineA().
Hi everyone
Is there any way to change a class definition (especifically a query definition during the compilation time)?
The idea is:
I have an abstract class with a parameter where I will define the ROWSPEC of a query and some methods to populate e temporary table
The implementation class will override the parameter, specifying the ROWSPEC of this implementation, and the methods will populate the rows in the same format as the ROWSPEC.
I am working with Caché Relationships.
I know how to iterate through the One side of the relationship and for each One iterate through all the various Manys.
What I have been trying to figure out, is the code (I can put into a Class) that will start at the top of the Manys, iterate down and for each of the Manys, pull the associated One.
I can do this with SQL or Globals, but I want to use only Class type code.
Is that clear? Any help?
Quotes (1NF/2NF/3NF)ru:
Every row-and-column intersection contains exactly one value from the applicable domain (and nothing else). The same value can be atomic or non-atomic depending on the purpose of this value. For example, “4286” can be
- atomic, if its denotes “a credit card’s PIN code” (if it’s broken down or reshuffled, it is of no use any longer)
- non-atomic, if it’s just a “sequence of numbers” (the value still makes sense if broken down into several parts or reshuffled)
This article explores the standard methods of increasing the performance of SQL queries involving the following types of fields: string, date, simple list (in the $LB format), "list of <...>" and "array of <...>".
I needed to pass through a file with Ensemble but the operation wasn't writing some filenames as given because the EnsLib.File.PassthroughOperation 'sanitizes' filenames removing characters that are not valid on some operating
systems;
09000655_AEDC_C3344059_A/E_Martin Browne_09000655_201706221018.pdf
09000655_AEDC_C3344059_A#47E_Martin_Browne_09000655_201706221018.pdf
Oh No! It has stripped out my semicolon and ampersand! I need them! (and they are valid filename characters in windows)
Caché offers a number of methods for going through a collection and doing something with its elements. The easiest method uses a while-loop and lets you fulfill the task in an imperative manner. The developer needs to take care of the iterator, jumping to the next element and checking if the loop is within the collection.
Good day, I have this issue. I have global like: ^myglobal(varX) = $LB(var1,var2). I need to delete all globals that have variable var1 in that list same without a need to iterate through all globals and checking their value.
Exact example:
- in database exist following:
Good day, I would like to find out the size of Caché ObjectScript variable in order to guarantee that my program will not leak, equally in terminal and Caché globals. For example how huge number I can store in that variable ? And what happen in Caché when variable will leak ? How is this behavior treated? (how much memory is reserved for common variable?)
Thanks in advance for your answers.
Sometimes, it comes in very handy (especially for the EAV model) to use array properties in a class and be able to qickly search by their elements: both the key and the value.
Let’s take a look at a simple example:
This is a translation of the following article. Thanks [@Evgeny Shvarov] for the help in translation.
This post is also available on Habrahabrru.
The post was inspired by this Habrahabr article: Interval-associative arrayru→en.
Since the original implementation relies on Python slices, the Caché public may find the following article useful: Everything you wanted to know about slicesru→en.
Note: Please note that the exact functional equivalent of Python slices has never been implemented in Caché, since this functionality has never been required.And, of course, some theory: Interval treeru→en.
All right, let’s cut to the chase and take a look at some examples.
This post is originally posted on GitHub.
This discussion is open to anyone who use or know about WebTerminal project. It is a result of a long story of the project development, testing and maintaining.
Class documentation:
class %Exception.General extends AbstractException
Simple exception class that can be throw in user code. You can throw this with code similar to:
Throw ##class(%Exception.General).%New(name,numericCode,location,data)
The name is a string name for the exception, the numericCode is a numeric error code. If the location field is blank and $$$envCallerErrorInfo is defined then the system will attempt to fill in this location where the exception was thrown from automatically. You can pass additional exception data in the data argument.
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.
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
ClassMethod main() As %String
Hello experts,
I’m working on an "Sort After" (]]) bug that I traced back to some weird behavior in ObjectScript. Perhaps someone can enlighten me…
The problem is as follows:
Let’s say we have:
Set A = “1.0” Set B = “2.2”
If you execute the command ‘Sort After’ (]]), you get the following:
W A]]B 1
…Which is wrong, A does NOT sort after B. The output should be 0.
If you set A and B to numeric values, it correctly outputs false (0):
set A = 1.0 set B = 2.2 W A]]B
0
The Cogs.JsonClass library is now available in the Cogs project on GitHub.
https://github.com/SeanConnelly/Cogs
Please see the README and the /docs folder on how to use the class.
Overview
The Cogs.JsonClass class provides a one step serialisation and deserialisation to and from Caché registered and persistent classes. It is not dependent on any other code and should be compatible with older versions of Caché.
The unit tests have been included in the update, but until I release the dependent Touchstone unit test solution it won't be possible to run these tests.
Hello everyone,
I'm doing a REST service for integration between 2 systems. The system that invokes me expects a response object where only one of its attributes changes. It could be something like this:
Class ResponseCustomer {
Property Code As %String;
Property Info As Customer;
}Class ResponseAppointment {
Property Code As %String;
Property Info As Appointment;
}Class ResponseCancellation {
Property Code As %String;
Property Info As %String;
}I need to guarantee that a parent AND child rows has been inserted successfully before any other process is able to read ANY of the data.
What is the proper way to prevent DIRTY reads? Per the InterSystems's documentation I should be able to use 'START TRANSACTION ISOLATION LEVEL READ COMMITTED'. I have attempted to use these commands in embedded and dynamic SQL calls to no avail.
I have to be able to insert the data via JDBC calls, but legacy Caché (.MAC) may be reading the data, and if the data is read to quickly, I could have processing errors, as all the child rows have not been inserted.