Oliver Thompson · Jun 13, 2024 go to post

Thanks for the clarification.

The answers from @Manel Trèmols and @Ramil TK should both work for you.

You might have to do some additional formatting depending on what datePart you getting the difference in. For example if you get the difference in Minutes ("n"), then you will have to convert that into Days, Hours, Minutes etc, so it will depend on what you are expecting in the data and how big those differences might be.
 

Oliver Thompson · Jun 20, 2024 go to post

One other thing to note is that you should not put any long running processes in %ZSTART as they will hold up the Start process.

If you have to, then consider JOBbing it off to a separate process, so it can run in the background and allow the rest of the startup steps to run in parallel.

Oliver Thompson · Jul 25, 2024 go to post

For quick and dirty logging I use:

kill ^Log at the beginning of the ClassMethod/Routine

Then use the following in your code to track what is going on:
set ^Log($increment(^Log))="Your message goes here. For example VariableX="_VariableX

Run your REST API and then take a look at ^Log.

You can either put lots of "set ^Log..." statements in, or just a few to narrow down where the issue is and just keep adding them till you get to the code in question. This might take a few iterations, but it generally works for me.

Oliver Thompson · Aug 28, 2024 go to post

When you JOB a process you can get the ID of the child Process with $ZCHILD.

You can then check to see if that process is still running.

Not sure whether you can HALT the process or not, and depending on what it is you are running, it might not be a good idea.

Oliver Thompson · Sep 5, 2024 go to post

I have just had to do something similar, but needed it to be Case Sensitive.
The only solution that I could find that would be Case Sensitive was the SQL solution.

Oliver Thompson · Oct 7, 2024 go to post

For me, if I was faced with 2 possible solutions and was concerned about performance, I would simply test both solutions within a loop and time how long it takes to do n number of loops.
Something like this

Class Performance.Test [ Abstract ]
{ClassMethod SolutionA() As %Status
{
 
    set x=9
    quit $$$OK
}ClassMethod SolutionB() As %Integer
{
 
    set x=9
    quit 1
}ClassMethod TestSolutions()
{
 
    write "SolutionA Start : "_$zdatetime($ztimestamp,3,1,3),!
    for i=1:1:90000000 {
        set ret=..SolutionA()
    }
    write "SolutionA End : "_$zdatetime($ztimestamp,3,1,3),!
    
    write "SolutionB Start : "_$zdatetime($ztimestamp,3,1,3),!
    for i=1:1:90000000 {
        set ret=..SolutionB()
    }
    write "SolutionB End : "_$zdatetime($ztimestamp,3,1,3),!
}}

Oliver Thompson · Nov 25, 2024 go to post

You could write your own std deviation ClassMethod() in ObjectScript. You then have the flexibility to use that however you want.

The logic doesn't look that complex, and for a few thousand rows would run fast enough in Object Script.
See link below for the calculations you need to do:

https://www.scribbr.com/statistics/standard-deviation/
You can validate your results with the STDDEV(SQL) method, which will also allow you to compare performance.

If restarting Studio fails to resolve the issue, try rebooting your machine.

Just had this happen to me, restarting Studio, which normally fixes the issue failed.

Rebooting my laptop fixed the issue.
Studio Version.
InterSystems Studio Client  2022.1.3 Build 670 Patch 1
Server IRIS for Windows (x86-64) 2022.1.3 (Build 668U)

I don't see why you can't create another ClassMethod to test GetAllRecords()
Your test ClassMethod would need to create instances of %CSP.Request and %CSP.Response and set any properties required but it should be possible.

Looking at the Documentation for %CSP.Request it actually mentions the Command Line:
http://cg-az-cendev01/csp/documatic/%25CSP.Documatic.cls
property CSPGatewayRequest as %Boolean [ InitialExpression = 0 ];

True if the request came the CSP Gateway, and false if it was from the command line or the built in web server.

This is the correct answer. $SYSTEM.SQL.Functions.DATEADD() will allow you add/subtract based on any of the date parts.

Did you check the port that management portal is running on?
Given that you have just done an install, it may have changed from the default?

This should show you the port that is being used: (Thanks to Jeffrey Drumm for this code).
%SYS>d ##class(Config.Startup).Get(.Prop)

%SYS>w Prop("WebServerPort")

This is a mix of the 2 other suggestions:


select count(*)
from Ens.MessageHeader
where TimeCreated between '2025-02-01 00:00:00' and '2025-02-28 23:59:59'
group by sessionid

All 3 options will work, always more than 1 way to skin a cat.

I would look a the SQL Show Plan to see which one is the most efficient.

If this is just for a quick/dirty directory listing from terminal, you can also use !, exclamaiton mark, this runs the host OS terminal, you can then run any OS commands that you need to.
Once you are done, just type EXIT (On Windows) and you will be back to your IRIS terminal session.

I can't help with the specific error, but you can configure Caché to keep the INT for SQL Queries on this page in System Management Portal:
  System > Configuration > SQL  - (configuration settings)* 
Look for "Retain cached query source"
And the <EXTERNAL INTERRUPT> has the following description:

<EXTERNAL INTERRUPT> Another process has attempted to interrupt this process.


This is in the docs, search for "System Error Messages" should get you there.