Matt Gage · Feb 8, 2023 go to post

The global delock means the global will stay locked until the top most transaction completes (tcommit or trollback), this is to protect against another process updating the global (assuming it uses locks) whilst your load is running.

You can effectively achieve the same with your own lock instead of the top level tstart

lock +^TESTfor I=1:1:N { 
    set^TEST(I) = $lb("", "123") 
    
} 
hang5lock -^TEST

Depending on your requirements, a timeout and lock failure handling might be needed

Matt Gage · Feb 8, 2023 go to post

I use this to enable OS level authentication for the terminal service inside a container to prevent prompting for login when accessing the IRIS command line inside a container. 

[Actions]
ModifyService:Name=%Service_Terminal,AutheEnabled=16
Matt Gage · Jun 25, 2023 go to post

Assuming you are using generated disp and impl classes from a swagger document, the simplest option you have at the moment is to edit the code in the impl class:

  • Use try/catch within your implementation method
  • the catch block to set %response.Status = your required status code
  • Create a json object with your required payload
  • return this object instead of the usual payload object

This will bypass the default error handling of the disp class.

It isn't ideal though.

e.g.

ClassMethod myFunction(arg1 As %Integer) As %Stream.Object
{
    try {
        set ret = {"data": "value" }
        if 1/0 // Force an error
    }
    catch err {
        set ret = ##class(SomeClass).FormatError(err)
        Set %response.Status = 500
    }

    quit ret
}
Matt Gage · Jun 25, 2023 go to post

However, it would be even more helpful to be able to override the default error display. This would need some changes to the dispatch and implementation class generators.

The dispatch class generator would need to call the specific implementation class to format the error, instead of the implementation superclass.

The implementation class generator also (really) needs to be able to accept an override for the implementation superclass via the swagger document (as there is for the dispatch class).

Then the try/catch would not be needed at all, and the default error handling would do everything needed.

This is as of Iris 2022.1. I'm not sure if this has been added in later versions.

Matt Gage · Aug 9, 2023 go to post

A little longer, but far more flexible, I've always liked

write $translate("DdMmCcYy", "CcYy-Mm-Dd",  $zdate($now(), 3))

Just provide the format you want in the first argument.

Matt Gage · Oct 4, 2023 go to post

Look into using Interoperability. The classes EnsLib.REST.Operation and EnsLib.HTTP.GenericOperation should do what you are looking for depending on if you are calling a REST service or it is plain HTTP

We have several business operations that use EnsLib.REST.Operation, each with pool sizes of between 2 and 60. Providing the http response indicates the connection can be maintained, they will keep the connection open.

Matt Gage · Jun 20, 2024 go to post

Consider a persistent class of MyObjects with a bitmap index on Property1, and then have a subclass of MySpecialObjects.

If I use

select * from MySpecialObjects where Property1 = 'Something'


I only want the items that are MySpecialObjects and not any other MyObjects. The extent index makes this possible. It ANDs the MySpecialObjects extent index with the Property1 index.

A bonus, is it also makes select count(*) very fast, even with tables of over 50,000,000,000 rows