I have a Task that I am trying to write the output to a file. How do I check for if the Output File has been included in the Task Schedule, so I can direct my output of my class to that output file?
Thanks
Scott
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.
I have a Task that I am trying to write the output to a file. How do I check for if the Output File has been included in the Task Schedule, so I can direct my output of my class to that output file?
Thanks
Scott
Hello,
I have a class with a "Unique" index (pxfactidIndex) on a %Numeric property (pxfactid) (partially-edit code snippet below):
Property pxfactid As %Library.Numeric(MAXVAL = 9223372036854775807, MINVAL = -9223372036854775808, SCALE = 0) [ SqlColumnNumber = 7 ];
Index pxfactidIndex On pxfactid [ Unique ];
Storage Default
{
<Data name="FactDefaultData">
<Value name="1">
<Value>pysubjectid</Value>
</Value>
...
<Value name="6">
<Value>pxfactid</Value>
</Value>
...
</Data>
<DataLocation>^CRMBI.FactD</DataLocation>
<DefaultData>FactDefaultData</DefaultData>
<ExtentLocation>Hi Community,
i'm trying to figure out how to pass a string to a routine from Powershell:
####
ROUTINE ImplUtil
Say(pSomething = "hello, i'm the ROUTINE") public{
w !,pSomething,!
}
####
call: irissession healthconnect -U user 'Say^ImplUtil(12345)'.png)
what's the right way to pass in text?
Are there any direct command to find the length of subscript of global variable? Is it possible to code in objectscript to find the maximum length of subscript in a global variable.
I am struggling on how to pull out individual fields from a JSON. In a previous post someone had mentioned that I could...
If ((tHttpResponseIsObject) && ($ZCONVERT(tHttpResponseContentType,"L") [ "application/json"))
{
set responseData = {}.%FromJSON(tHTTPResponse.Data)
set pResponse = ##class(osuwmc.COM.Response.StringResponse).%New()
if responseData.count =1{
set pResponse.COMPortalURL = responseData.items.%Get(0).portalUrl
set pResponse.COMPureID = responseData.items.%Get(0).pureId
set pResponse.COMTitle = responseData.items.%Get(0).titles.%Get(0I am testing vectorsearch, while doing so I am trying to paginate my resultset for a "next page" function to give me the first, second, third 15 entries within a table.
For this I have two embedding classes. One with a HNSW Index (vectornomicembedtextlatest), and one without (vectornomicembedtexttest).
Calling SELECT ID,PRIMKEY FROM SQLUser.vectornomicembedtexttest LIMIT 5 OFFSET 1 works fine with the first entry having the rowID of 486448. (I deleted old entries in the beginning and reused the table)
SELECT ID,PRIMKEY FROM SQLUser.
Hello Community,
When I run the following code with x undefined in terminal, it throws a syntax error and returns control to the program stack. After issuing a GO command, execution continues, and setting the global variable ^zz1.
code 1:
test.mac
if $Data(@x@(a,b,c)) {
set ^zz1=1212
}
write !,1212,!
//
//or
if $Data(@x@(a,b,c)) set ^zz1=1212
write !,1212,! if I assign the result of $D(@x@(a,b,c)) to a local variable like d using set d=$D(@x@(a,b,c)), and then use if d { ... }, the code fails(global is not set) working as expected.
Code 2
I'm creating a Business Process that:
The Business Process is created with BPL, and objects are stored in BP context. When I execute this Process, in the 3rd point the object obtained in first transformation doesn't exist. It's empty.
Hello Community,
Is it possible to retrieve/find all the names of subroutines, procedures, or functions from a deployed routine?. in the routine below, how can I extract names like x2 and execsql? I’ve just tried using openId on %RoutineMgr but it didn’t help.
xdeploy.mac
xdeploy
quit
x2 ; test1
write 123
q
execsql(sql) ; test2
Set tResult = ##Class(%SQL.Statement).%ExecDirect(,sql)
Return tResult
Thanks
Hello Community,
I executed the below query in the %ZLANGC00.mac routine. It returns results when using dynamic SQL, but not with embedded SQL(returns 0).
&SQL(SELECT count(*) INTO :Cnt FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'")
Write "SQL Table count : "_Cnt,!
Set tResultSet = ##class(%SQL.Statement).%ExecDirect(,"SELECT count(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'")
Do tResultSet.%Display()Thanks!
I have a table in the development and want to erase data from certain columns. There is info in the docs but not for human
This piece of code does not work
ALTER TABLE table DROP COLUMN column %DELDATA
The class context for an instance method is the current object reference (OREF).
The class context for a class method is the current classname as a string value."
As my example below shows, either the documentation or the implementation (or both) is wrong, I always call a class method (Value) and expected the class name as the return value but got either the class name or an OREF. Moreover, if I repeat the call, I get another values. But why?
I am running into an issue where a JSON response is missing keys...
{
"count": 0,
"pageInformation": {
"offset": 0,
"size": 10
},
"items": []
}Within the JSON response I am only looking for two fields portalUrl and portalId. I have tried using $LENGTH and %IsDefined to check if they are valued but neither work.
If ((tHttpResponseIsObject) && ($ZCONVERT(tHttpResponseContentType,"L") [ "application/json"))
{
set responseData = {}.%FromJSON(tHTTPResponse.Data)
set pResponse = ##class(osuwmc.COM.Response.Hello Community,
When retrieving strings from the DAO, if the string exceeds the capacity of an ObjectScript string variable, it returns <MAXSTRING>. To prevent this, use dao.%Get(key, default, "stream") to retrieve the value as a stream (%Stream.DynamicBinary). However, Why can't we use other stream objects such as %Stream.TmpCharacter instead of %Stream.DynamicBinary/%Stream.DynamicCharacter (I understand It is not possible to create a direct object instance for %Stream.Dynamic* classes) .
I am trying to replicate a REST call that I am able to make via a Postman call within a EnsLib.REST.GenericOperation.
It's been a while since I have messed around with trying to make external REST calls. When I execute my REST call, tSC is coming back with an error and I am trying to pinpoint why. I tried turning on ISCLOG = 5 but when calling the REST Operation from the Testing tool it is not logging anything to the ISC log.
How do we see the RAW request being sent out to verify that my request is formatted properly?
It helps to remove special characters, such as non-utf-8 characters either control characters or unicode characters from text that is not printable or can't be parsed by downstream systems.
There is also $C(32) in this condition; sometimes NBSP appears in the text and it will not be recognized by TIE, but downstream it displays as "?".
In order to avoid the NBSP issue, the if condition is replaced with a space in order to prevent the error.
Unicode characters only Remove:
Hello Community,
I have a queue that I need to traverse and perform operations on. To distribute the workload across multiple processes, I used a Work Queue Manager do process and I'm not expecting any status from it So, I skipped Sync / WaitForComplete in my implementation
Hi devs!
Suppose I have an instance of a persistent class:
Set person = ##class(dc.Sample.Person).%OpenId(1)Class is an ancestor of %JSON.Adapter.
How can I convert it to dynamic object with the properties that person.%JSONExport() provides?
{"Name":"Elon Mask","Title":"Associate Accountant","Company":"InterSystems","Phone":"799-933-5569","DOB":"1926-12-11"}Couldn't find a right method.
set dynObj = ##class(%ZEN.Auxiliary.altJSONProvider).%ObjectToAET(person) works, but adds id and classname, which I don't want to be added:
zw dynObj
dynObj={"_class":"dc.Sample.The Good Old Days
The %Library.DynamicObject class has been in IRIS since before it became IRIS. If you have been using it since the Cache days, you may want to brush up on some of its changes.
In Cache 2018, the %Get method only had one argument. It was the key to retrieving from the JSON, meaning that if your JSON object called myObj, it would look like the following:
Hello IRIS community,
InterSystems Certification is developing a certification exam for InterSystems IRIS Developer professionals, and if you match the exam candidate description given below, we would like you to beta test the exam.
I have an IRIS persistent class with a %Stream property whose value is a JSON object. I'd like to use a SQL trigger to pull some value out of the JSON and persist it in another property, for easy querying and indexing. See below for a minimal example:
Class PAB.DebugStream Extends %Persistent
{
Property Contents As %Stream.GlobalCharacter;
Property msg As %String;
ClassMethod InsertRow()
{
set stream = ##class(%Stream.GlobalCharacter).%New()
$$$ThrowOnError(stream.Write({"msg":"hello world!"}))
&sql(insert into PAB.I think I found my solution but I'm trying to understand better why it works. Forgive me as my descriptions here may be scattered but I'm trying to piece the puzzle together.
Scenario: I've found there are times when I make a request using a %Net.HttpRequest object and as I'm debugging and stepping through via the debugger in VSCode, if I try to access an object in the 'variables' menu, sometimes when I click that little expand button it will just spin and never load what's in the object to the viewer.
I was wondering if someone could help me. In the past I have been able to call external Stored Procedures through a SQL Outbound Connection and have them return me the EnsLib.SQL.Snapshot to use within a BPL to extract data.
But this time instead of using a SQL Outbound BO to make the Stored Procedure call, I decided to create a Linked Stored Procedure through the %JDBC_Server to point to the Stored Procedure out on MS SQL.
However, I am struggling to get the code just right to return the Column value from the Linked Stored Procedure.
set result = ##class(EnsLib.SQL.Snapshot).After upgrading from 2024 to 2025 Im not able to compile any class.
I was using ZPM and git-source-control.
Now Im getting
Compilation started on 04/19/2025 20:53:00 with qualifiers 'cuk /checkuptodate=expandedonly'
ERROR #5002: ObjectScript error: <CLASS DOES NOT EXIST>OnAfterSave+4^SourceControl.Git.Extension.1 *SourceControl.Git.Utils
Detected 1 errors during compilation in 0.209s. class '%Studio.SourceControl.Interface', method 'OnBeforeTimestamp': <CLASS DOES NOT EXIST> 150 I disabled SourceControl in Management portal and nothing happen.
I added extra OBX segments and I need to renumber OBX 4 so they are sequential.
.png)
Say I have an ObjectScript object called Book. It has 2 properties title and author. It extends JSON.%Adaptor, so I can call book.
If you're solving complex problems in ObjectScript, you probably have a lot of code that works with %Status values. If you have interacted with persistent classes from an object perspective (%Save, %OpenId, etc.), you have almost certainly seen them. A %Status provides a wrapper around a localizable error message in InterSystems' platforms. An OK status ($$$OK) is just equal to 1, whereas a bad status ($$$ERROR(errorcode,arguments...)) is represented as a 0 followed by a space followed by a $ListBuild list with structured information about the error. $System.Status (see class reference) provides several handy APIs for working with %Status values; the class reference is helpful and I won't bother duplicating it here. There have been a few other useful articles/questions on the topic as well (see links at the end). My focus in this article will be on a few debugging tricks techniques rather than coding best practices (again, if you're looking for those, see links at the end).
Hello Community,
The subroutine ^routine is not executed while the queue is being processed in WorkMgr. However, it works when defined as a function. Is it mandatory to define subroutine^routine as a function for it to execute properly?
testwqm.mac
set wqm = ##class(%SYSTEM.WorkMgr).%New()
set sc=wqm.Queue("subr1^testwqm") ; not executing the subr1
set sc=wqm.Queue("subr2^testwqm") ; executing the subr2 properly
set sc=wqm.Hey everyone.
I'm currently looking at a process where we're utilising the Class Ens.StreamContainer, and was looking to do some deletions outside of any purge routines.
Having been burned before, I wanted to make sure that deleting the container also deletes the contents within.
From looking in the class, the %OnDelete ClassMethod appears to be removing an index from a search table and nothing more.
Am I looking in the right place, or is there a extended class for Ens.StreamContainer that does in fact delete the %Stream.Object
contained within the Ens.StreamContainer?
I need to add an extra blank OBX segment after a segment containing text, Total Cost:
I get the OBX segment but it is in incorrect location.
It should be after the line containing Total Cost:
It needs to contain:
code:
If (tOBXText[ "Total Cost:") {
Set tSegmentOBX = ##class(EnsLib.HL7.Segment).%New()
Set tSegmentOBX.SegType = "2.3:OBX"
Set tSC = tSegmentOBX.SetValueAt("OBX", 0, "set")
Set tSC = pOutput.