Eduard Lebedyuk · Sep 2, 2021 go to post

Go to System  > Journals, choose any 1GB journal which was just created and press Profile.

Now recalculate by size and you'll see which globals created the most journal records.

Eduard Lebedyuk · Aug 27, 2021 go to post

is there a way for me to execute in SQL for the above?

Of course!

Queries are TVFs, you can CALL them or SELECT from them:

SELECT *
FROM %SYSTEM.License_ConnectionAppList()

Summary:

SELECT *
FROM %SYSTEM.License_Counts()
Eduard Lebedyuk · Aug 26, 2021 go to post

Check %SYSTEM.License queries. There are queries which provide summary and detailed information on license consumption. You can than create a task which runs every minute and if license consumption exceeds say 80%, store current license users into a separate table with a timestamp. Later you can use this table to analyze usage patterns.

Eduard Lebedyuk · Aug 26, 2021 go to post

I need for this operation to run in a same, separate process (on which I need to do bookkeeping) so InProc mode won't work for my use case.

Eduard Lebedyuk · Aug 25, 2021 go to post

Do you have SMP access? If so:

  1. Open any CSP app config, i.e. /csp/user.
  2. Note which folder it takes files from (CSP Files Physical Path property).
  3. Export production/classes/whatever into this folder into one xml file.
  4. Download the file from a browser.
Eduard Lebedyuk · Aug 23, 2021 go to post

Check the permissions/ownership on:

<IRIS>/csp/bin/CSP.ini

Most likely irisusr is unable to access this file.

Eduard Lebedyuk · Aug 20, 2021 go to post

Code must be executed in the Business Operation process, I can't offload it to another process.

Eduard Lebedyuk · Aug 20, 2021 go to post

Looks like, that you have some data generated, which you should care about, but with some delay.  

Yes.

how about creating some custom adaptor,  

How would this adapter be triggered every X seconds?

Eduard Lebedyuk · Aug 19, 2021 go to post

Ok, but how does it work?

The P command suppresses terminal screen display. It suppresses all terminal display, including displaying the terminal prompt.
Specifying P with no operand toggles display suppression.

Docs.

Eduard Lebedyuk · Aug 18, 2021 go to post

Alternatively, you could create a function that writes the alerts to an internal table, and then poll that table every x minutes to generate a single detailed alert message?

Sounds promising. I don't know - just wanted to use alerts as that seemed like a tool for a job but maybe a custom solution would be better.

Eduard Lebedyuk · Aug 13, 2021 go to post

What do you want your $list to look like?

If you want the end result to be like this:

$lb("das", "is", "wp", "dsa", "nmk")

try this code (assumes dir is shorter that 3 641 144 chars):

ClassMethod test(dir = "test.txt")
{
    set file = ##class(%Stream.FileCharacter).%New()
    set file.LineTerminator = $c(1)
    do file.LinkToFile(dir)
    
    set str = file.Read($$$MaxStringLength)
    
    kill file
    
    set separator = $c(13,10)
    do {
        set newstr = str
        set str = $replace(str, separator _ separator, separator)
    } while newstr'=str
    
    set:$e(str, 1, $l(separator))=separator str=$e(str, 1 + $l(separator), *)
    set:$e(str, *-$l(separator)+1, *)=separator str=$e(str, 1, *-$l(separator))
    set list = $lfs(str, separator)
    quit list
}

This is a naive implementation assuming you don't care about the speed.

Faster solution would go through file line by line.

Eduard Lebedyuk · Aug 12, 2021 go to post

You have to include a slash before EmergencyId :

It depends on OS. In Linux there's no slash. Windows is with slash.

Eduard Lebedyuk · Aug 8, 2021 go to post

You need to:

  • Open Training.NewProduction in the Management portal
  • Start Training.NewProduction  
  • Stop Training.NewProduction  
  • Open your new production in the Management portal 

After that you'll be able to start your new production.

Eduard Lebedyuk · Aug 4, 2021 go to post

There are two parts to it.

1. Create a trigger after INSERT/UPDATE/DELETE. Triggers can work for both sql and object access:

Trigger NewTrigger1 [ Event = INSERT/UPDATE/DELETE, Foreach = row/object, Language = objectscript, Time = AFTER ]
{
    set ^dbg={fieldname*N}
}

2. In the trigger code send an SMS. You can either use an API (a lot of them available) or talk to a GSM modem.

Eduard Lebedyuk · Aug 4, 2021 go to post

First you need to create corresponding classed. You can do that by either importing the XSD or manually.

Here's a manual approach:

Class test.mensajeWS Extends (%RegisteredObject, %XML.Adaptor) {

Parameter NAMESPACE = "https://wslexnet.webservices.lexnet/3.22";

Property respuestaEnvioMensaje As respuestaEnvioMensaje;
}


Class test.respuestaEnvioMensaje Extends (%RegisteredObject, %XML.Adaptor) {

Property idEnvio As %Integer;

Property tamBloque As %Integer;

Property bytesMIME As %VarString;
}

After that in your BS convert incoming XML string like this:

set reader = ##class(%XML.Reader).%New()
set sc = reader.OpenString(pRequest.EnviarIniciadoresGeneralOut)
quit:$$$ISERR(sc) sc

do reader.Correlate("mensajeWS","test.mensajeWS")

do reader.Next(.mensajeWSObj,.sc)
quit:$$$ISERR(sc) sc

// Process mensajeWSObj
Eduard Lebedyuk · Aug 2, 2021 go to post

Great article.

Some comments on formatting:

  1. Move large code blocks under spoiler to improve readability using button.
  2. There are a lot of empty lines in code blocks, they can be safely removed.

On the article itself my only issue is you create 5 methods per class:

  • GET /class
  • POST /class
  • GET /class/object
  • PUT /class/object
  • DELETE /class/object

That's a lot of code even for 4 classes, but what about a case where there are 10 classes? 50? 100? Generally I would recommend writing 5 methods which would process objects of any allowed class (see RESTForms2).

Eduard Lebedyuk · Jul 30, 2021 go to post

I think the preferred way is to use $SYSTEM.OBJ.Export (or even better - VCS) instead of direct global manipulation to export code.

Eduard Lebedyuk · Jul 29, 2021 go to post

Set in the BP/BPL classes:

Parameter SKIPMESSAGEHISTORY = 1;

it would improve journaling.