Lorenzo Scalese · Mar 8, 2022 go to post

Hello,

Thank you for this useful tool.
I have an install using HealtShare 2018.1.4 where the node "stat" does not exists .

^rINDEXSQL("sqlidx",1,hash,"stat")

There is something to enabled ? 

I don't have this problem on my own install. Thank you.

Lorenzo Scalese · Mar 30, 2022 go to post

Hi,

You can use 8 for the date format part, but there is no time format parameter for HHMM. Try with this line :

w $tr($ZDATETIME($zdth($zstrip("2022-03-29T15:10:00+0100","<>W"), 3,5),8,2)," :","")
Lorenzo Scalese · Apr 4, 2022 go to post

Hi @Alexey Maslov,


Interesting, we have the same problem and apply the same solution :-) !


There is more than 10 years ago, I have written an archiving tool to move document stream to a share and just keep the file reference. The process is long, but there is no downtime. It's exactly the same situation.

The archive tool is included in our application administration panel and the customer can decide himself to archive.  

Today, I have read-only globals nodes (not documents) that became very bigger. So, I try an approach with an "archive" database to reduce the volume of our main database(s).
If you are interested in global moving without downtime there is (live-global-mover)[https://openexchange.intersystems.com/package/isc-live-global-mover], but it's not designed for mirroring and ECP.  

Lorenzo Scalese · Apr 7, 2022 go to post

Hi @Benjamin De Boe,

Yes, I recently took a look, but indeed I need it on an old version  (2018 )

However, our customers should migrate but I think that i can't use DataMove on production systems before the end of 2023.

In my opinion, DataMove is complete but just needs to be wrapped for special use cases (ex: manage global mapping on mirror switch).  It's not a problem, we can do this easily with a simple global and ZSTART routine (such as the sample).  

Maybe, I should modify this tool in this way if there is an interest.

Lorenzo Scalese · Apr 17, 2022 go to post

Hi @Robert Cemper !

Good Idea!

I tested, but unfortunately, It seems already too late, the rollback is already performed.

%ZSTOP routine

ROUTINE %ZSTOP
%ZSTOP
    Quit

SYSTEM
    Set ^zJob($i(^zJob)) = $ZDATETIME($HOROLOG, 3, 1) _" LABEL-SYSTEM (" _ $JOB _ ") "_$NAMESPACE _ " TLEVEL: "_$TLEVEL
    Do ZFORCECOMMIT
    Quit

LOGIN
    Quit
JOB
    Set ^zJob($i(^zJob)) = $ZDATETIME($HOROLOG, 3, 1) _" LABEL-JOB (" _ $JOB _ ") "_$NAMESPACE _ " TLEVEL: "_$TLEVEL
    Do ZFORCECOMMIT
    Quit
CALLLIN
    Quit

ZFORCECOMMIT
    If $Data(^zForceCommit($Job)) {
        While $TLEVEL {
            TCOMMIT
        }
    }
    Quit

Even if the process is in a transaction before "terminate", the ^zJob trace records a $TLEVEL with the value 0.

Maybe it's just not possible (or possible with a not documented procedure).

Thank you.

Lorenzo Scalese · Apr 18, 2022 go to post

Hi @Robert Cemper, @Vitaliy Serdtsev 

Thank you for your replies! I found a solution to do this without any change to an existing code, not simple but It works and could be useful in a critical situation.

I read the code of ^%ETN and see these lines :

UserError() s $zt="UserErrorE"
 i $d(^rOBJ("%ZERROR")) d 
 . n %00000 d ^%ZERROR

So, If we create a "%ZERROR" routine, we have an entry point :

ROUTINE %ZERROR

%ZERROR
    If $Data(^zForceCommit($Job)) { ; to avoid do this for all processes...
        While $TLEVEL {
            TCOMMIT
        }
    }

    Quit

And then, we must terminate the process like that:

Set pid = "1234" ; pid to terminate
Set ^zForceCommit(pid)=""
Zn "%SYS"
Set process = ##class(SYS.Process).%OpenId(pid)
Set sc = process.Terminate(1)

It's important to use the SYS.Process class and the Terminate method with argument 1 to use ^%ETN.

Lorenzo Scalese · May 17, 2022 go to post

Hello,

If you need an alternative, you can use the Config package in "%SYS"

Ex : 

New$NamespaceSet$Namespace = "%SYS"Set properties("Database") = "YourPackageDatabaseCode"Set sc = ##class(Config.MapPackages).Create("YourNameSpace","PackageName", .properties)
Quit sc

There is also a library to do this with a json configuration file config-api, but it's heavy just for a mapping.

Lorenzo Scalese · May 20, 2022 go to post

Hi,

Another possibility using %Regex.Matcher :

Set REC = "MILFORD, OH 45150 "
Set m=##class(%Regex.Matcher).%New("([a-zA-Z]+)([\s,]+)([a-zA-Z]+)([\s,]+)([0-9]{5})")
Set m.Text = REC
Do m.Locate()
Set ZIP = m.Group(5)
Set CITY = m.Group(1)
Set STA = m.Group(3)
Lorenzo Scalese · Jun 14, 2022 go to post

Hello,

In addition to the previous answers,  there is the zpm module OpenApi Client Gen in order to generate an Objectscript client (with or without interoperability production) from a swagger 2.0 file.

Lorenzo Scalese · Jul 2, 2022 go to post

Hi @Robert Cemper !

Good Idea for the table.
In french : 

 

English French  
Data Donnée F
Value Valeur F
Database Base de données F
File Fichier M
Directory Répertoire M
Lorenzo Scalese · Jul 5, 2022 go to post

Hi,

Two years ago, I analyzed the behaviours using stream and %Persistent class.  

Class Test.Stream1 Extends%Persistent
{

Property st As%GlobalBinaryStream;ClassMethod add1() As%Status
{
	; write stream in ^Test.Stream1SSet o = ..%New()
	Do o.st.Write("azeruiop")
	Quit o.%Save()
}

ClassMethod add2() As%Status
{
	; write stream in ^CacheStreamSet o = ..%New()
	Set st = ##class(%GlobalBinaryStream).%New()
	Do st.Write("azeruiop")
	Set o.st = st
	Quit o.%Save()
}

Storage Default
{
<Data name="Stream1DefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>st</Value>
</Value>
</Data>
<DataLocation>^Test.Stream1D</DataLocation>
<DefaultData>Stream1DefaultData</DefaultData>
<IdLocation>^Test.Stream1D</IdLocation>
<IndexLocation>^Test.Stream1I</IndexLocation>
<StreamLocation>^Test.Stream1S</StreamLocation>
<Type>%Storage.Persistent</Type>
}

}

The method add2 use ^CacheStream due to the default storage usage (as described by @Robert Cemper ).  

However, We can force the storage in ^Test.Stream1S with :
Do st.%LocationSet("^Test.Stream1S")

Lorenzo Scalese · Jul 12, 2022 go to post

Hello @Theo Stolker,

The problem with the proxy generation is also due to the "-" character management. The generation fails if there is a "-" in the path parameter, ex: 

/1/user/-/foods/log/water/{water-log-id}.json

This issue is fixed in version 1.4.2.

Thank you for your report !

Lorenzo Scalese · Jul 14, 2022 go to post

Hello,
Have you ever checked the contents of the database journal files?  

You should find "Kill" related to these globals entries. 

This might give you some clues without code edition.

Lorenzo Scalese · Sep 22, 2022 go to post

Hello @David Hockenbroch

I tested this simple method using CodeMode = Objectgenerator :

Method test() [ CodeMode = objectgenerator ]
{
	Write
	Quit 1
}

Do $SYSTEM.OBJ.Compile("User.NewClass1","ck") We can see a lot of variable values at compile time :

....
%qstruct="ck"
....

%qstruct contains compile flags and qualifiers

Lorenzo Scalese · Feb 2, 2023 go to post

Haha Thank you @Guillaume Rongier 

Roughly 2 years ago I worked on a client generator for specification 2.0 because the server-side generator (^%REST) support 2.0 only.
I was expecting a support V 3.0 for ^%REST, but I wasn't sure InterSystems had planned this development.

So, I decided to develop a "Suite" with client, production and REST server generator for version 3.

Thank you for your praise about UI, to be honest, today, it's just a simple CSP using Bootstrap , I would like to develop a more advanced interface using Angular, but not possible for the contest timing.  I have a few ideas, but that will come later.

Lorenzo Scalese · Feb 2, 2023 go to post

Hi, 

I never tested myself, but in Python, there is pdfkit library.

Maybe the support of Python with IRIS could be useful for your case.

Lorenzo Scalese · Feb 3, 2023 go to post

Hi @Stefan Cronje ,

Indeed the repository template used for this development uses it.
If you have an instance with IPM (ZPM), you can install openapi-suite just with : 

zpm "install openapi-suite"; and optionally swagger-ui
zpm "install swagger-ui"

All dependencies will be automatically installed.

It needs a namespace with Ensemble enabled.  You can easily enable Ensemble on a namespace just like that : 

Do##class(%Library.EnsembleMgr).EnableNamespace($Namespace, 1)