Ashok Kumar T · Nov 25, 2025 go to post

You can determine whether the value is an object by using $IsObject(value) before processing it.
Alternatively, you can rely on the third argument of %GetNext(,,.type), which tells you the datatype of the value.

Example code

set iter = identifiers.%GetIterator()
while iter.%GetNext(.key, .value, .type) {
    if $IsObject(value) {
        set text = value.%Get("text")
    }
}
set iter = identifiers.%GetIterator()
while iter.%GetNext(.key, .value, .type) {
    if type = "object" {
        set text = value.%Get(key) ;for example value.%Get("text")
    }
    if type = "array" {
        set text = value.%Get(index)  ; for example: value.%Get(0)
    }
}
Ashok Kumar T · Nov 25, 2025 go to post

Hi @Marcelo Witt 

AutoParallel and Adaptive Mode are enabled by default in InterSystems IRIS SQL query optimizer. Because of this, IRIS will automatically determine when parallel query execution is beneficial. Therefore, you usually don’t need to manually specify %PARALLEL unless you want to force parallelism or override the optimizer’s decision.

  • When AdaptiveMode is enabled, automatic parallel processing is applied to all SELECT queries, hinting them with %PARALLEL. However, not all queries may use parallel processing as the SQL Optimizer may decide otherwise.
  • When we are trying to utilize this %PARALLEL feature, we must consider AutoParallelThreshold as well (default value is 3200) and there is no use with this parameter in case AutoParallel is disabled.
Ashok Kumar T · Nov 15, 2025 go to post

This is a really interesting idea, and I think it raises an important point: the InterSystems ecosystem has grown big enough that community tools are now essential, not just “nice extras.” Even though most of these tools are maintained by individuals, creating a foundation could potentially make their management more efficient by providing structure, funding, and shared resources to support maintainers and help ensure long-term sustainability.

Ashok Kumar T · Nov 4, 2025 go to post

Hi @Julius Kavay 
The literal array syntax set outArray = [] internally creates a %DynamicArray object. If both approaches ultimately produce a %DynamicArray, why is using the literal syntax reportedly about 50% faster than explicitly calling set outArray = ##class(%DynamicArray).%New()?

Ashok Kumar T · Oct 13, 2025 go to post

Hi @Lucrezia Puntorieri 
Yes you can create a method and classmethod programmatically.

Set clsmethodObj = ##class(%Dictionary.MethodDefinition).%New()
Set clsmethodObj.Name="TestClsMethod"
Set clsmethodObj.ClassMethod=1
Do clsmethodObj.Implementation.WriteLine($C(9)_"Set ^test=""Test"" ")
Do clsmethodObj.Implementation.WriteLine($C(9)_"Quit ^test ")

Set methodObj = ##class(%Dictionary.MethodDefinition).%New()
Set methodObj.Name="TestMethod"
Set methodObj.ClassMethod=0
Do methodObj.Implementation.WriteLine($C(9)_"For I=1:1:10 { S ^test(i)=i} ")
Do methodObj.Implementation.WriteLine($C(9)_"Quit ^test ")

Do clsObj.Methods.Insert(clsmethodObj)
Do clsObj.Methods.Insert(methodObj)
Ashok Kumar T · Oct 11, 2025 go to post

Hi Jack

IRIS does not provide built-in functionality to generate classes directly from a JSON Schema, unlike the support available for XML Schema (XSD). However, you can programmatically create and compile classes at runtime using the %Dictionary.ClassDefinition API.

Here is the sample code to generate a class.

ClassMethod CreateClass()
{	
	Set clsObj = ##class(%Dictionary.ClassDefinition).%New()
	Set clsObj.Name="Test.NewClass"
	Set clsObj.Super="%RegisteredObject,%JSON.Adaptor"
	Set clsObj.Description="Class created via code"
	Set clsObj.DdlAllowed = 1
	Set clsObj.Inheritance="left"
	
	Set propObj = ##class(%Dictionary.PropertyDefinition).%New()
	Set propObj.Name="Name"
	Set propObj.Type="%String"
	Set propObj.SqlColumnNumber=2
	Do propObj.Parameters.SetAt(70,"MAXLEN")
	
	Set indexObj = ##class(%Dictionary.IndexDefinition).%New()
	Set indexObj.Name="NameIdx"
	Set indexObj.Properties="Name"
	Do clsObj.Properties.Insert(propObj)
	Do clsObj.Indices.Insert( indexObj)
	Set st=  clsObj.%Save()
	D $SYSTEM.OBJ.Compile("Test.NewClass","ckb")
	If $$$ISERR(st) w $SYSTEM.OBJ.DisplayError(st)
}
Ashok Kumar T · Sep 28, 2025 go to post

Hello @Julius Kavay 

Thanks for pointing that out — you're absolutely right. The generator method for property initialization is missing. However, we are able to create an instance of %CSP.Page

Ashok Kumar T · Sep 4, 2025 go to post

Hello @Matheus Augusto 

%Stream.TmpCharacter is used to temporarily hold stream data in IRIS for application usage, typically in-memory and not persisted to the database.

Ashok Kumar T · Aug 21, 2025 go to post

Instead of using obj.%Get("property"), you can use %IsDefined("key"), which returns 1 if the key exists.

You can also use %Get("key",, "type"), where the optional type parameter specifies the expected return type. This helps prevent <MAXSTRING> errors when handling values near IRIS's maximum string length.

To enable native JSON support in a persistent class, extend %JSON.Adaptor. This provides built-in methods such as:

  • %JSONImport() — Imports a JSON or DAO directly into the object.
  • %JSONExport()— Export and display the value in the device
  • %JSONExportToString()— Export the value as a string.
  • %JSONExportToStream() — Export the value as a stream
Class Company.Employee Extends (%Persistent,%JSON.Adaptor) {
    Property Name As %String(MAXLEN=50);
    Property Age As %Integer;
    Property Department As %String(MAXLEN=50);

ClassMethod LoadData() As %Staus
{
    Set json = {"Name":"Test", "Age": 20, "Department": "IT"}
    Set obj = ..%New()
    Set sc = obj.%JSONImport(json)
    Set sc = obj.%Save()
    Return sc
}

ClassMethod ExportDataAsJSONString(Id) As %String
{
    Set obj = ..%OpenId(Id)
    Do obj.%JSONExportToString(.string)
    Return string
}

ClassMethod ExportDataAsJSONStream(Id) As %Steam.Object
{
    Set obj = ..%OpenId(Id)
    Do obj.%JSONExportToStream(.stream)
    Return stream
}
}

    If you're working with classes, it's recommended to use object-based or SQL-based data manipulation rather than directly using globals.

    Ashok Kumar T · Aug 21, 2025 go to post

    Hi @Rutvik ISM 

    The FHIR binary resource data is exceeding the maximum length allowed by InterSystems IRIS. To store documents such as PDFs and other large data, you should use streams.

    • Use %Stream.GlobalBinary or %Stream.GlobalCharacter to store the data within the database.
    • Use %Stream.FileBinary or %Stream.FileCharacter to store the files on the file system.
    Ashok Kumar T · Aug 21, 2025 go to post

    `Hi Rutvik

    You can handle this error with below code. Some sample code

    swt datatype "stream"
    While iter.%GetNext(.key, .value, .datatype) {
    }

    If you want to get the values as a stream from DynamicObject Use %Get(key,,"stream") 

    set stream = dao.%Get(key,,"stream")

    This 3rd parameter support in %GetNext() and %Get()  from 2022 version

    There is a specific reason for using this custom code instead of relying on the built-in %FromJSON() method. The third argument is currently not implemented in the following ##class(HS.FHIR.DTL.vR4.Model.Resource.Binary).%FromJSON(fhirresourceStream)

    ClassMethod SetBinaryR4(json As %DynamicObject) {
       Set obj = ##class(HS.FHIR.DTL.vR4.Model.Resource.Binary).%New()
       Set obj.contentType = json.contentType
       // Convert large data field to stream
       Set dataAsStrm = json.%Get("data",,"stream")
       Set obj.data = dataAsStrm
       Set obj.id = json.id
    }
    

    Thank you!

    Ashok Kumar T · Aug 21, 2025 go to post

    Kudos to You! 🎉 Your efforts have made a real difference. The passion and commitment you bring have not only contributed greatly but also sparked meaningful change.

    Thank you

    Ashok Kumar T · Aug 5, 2025 go to post

    The %BuildIndices class method is used to rebuild all indices on the class. To run it asynchronously, use the following:

    Do ##class(Ens.Util.Log).%BuildIndices()
    Do ##class(Ens.Util.Log).%BuildIndicesAsync()
    

    To rebuild a specific index, pass the index name as a list value:

    Do ##class(Ens.Util.Log).%BuildIndices($LB("TimeLogged"))

    You can also rebuild indices using SQL from 2021 version

    Rebuild all indices

    BUILD INDEX FOR TABLE Ens_Util.Log

    Rebuild a specific index

    BUILD INDEX FOR TABLE Ens_Util.Log INDEX TimeLogged
    Ashok Kumar T · Aug 5, 2025 go to post

    Hi @shima Avakh 

    Ens.Queue class provides various methods for working with queues. Queue-related information is stored in the global ^Ens.QueueTo abort messages from a specific queue, you can use the following class method

    Do ##class(Ens.Queue).AbortQueue(pQueueName) 

    Replace pQueueName with the name of the queue you want to abort. This method allows you to target and abort messages in a specific queue.

    Ashok Kumar T · Jul 23, 2025 go to post

    Thank you for the explantaion @Steven Hobbs .In the subroutine ETNMINIM, the date is retrieved solely from $H (S h=$H). Given that, why are the errors recorded under the date 01/06/1841 ($ZDH=6) in ^ERRORS instead of the actual date on which the error occurred?

    Ashok Kumar T · Jul 21, 2025 go to post

    You can use the Log() method  or do LOG^%ETN(ErrorMessage) inside the Try{} Catch ex{} block and routine to capture the error on Application Errors.