go to post Chris Stewart · Jun 3, 2024 If you just want a very basic conversion (i.e. not converting to a canonical date type first), then this will work set dt = "2024-05-31T17:33:08+01:00" set formatteddt=$ZSTRIP($PIECE(dt,"+",1),"*WPA") write formatteddt 20240531173308
go to post Chris Stewart · Apr 18, 2024 So, there's 2 ways to read this, either we want an "exists" check, or following the SQL, we want a count of all instances. This snippet can be set to do either case based on the existscheck boolean. Ideally though, you would have an index defined, and this could be read much more efficiently than having to scan an entire global set count=0 set existscheck=0 //Set to 1 if we only want to find first instance set targetValue=1329 set key = "" for { set key = $ORDER(^DataTest(key)) quit:key="" if targetvalue = +$LG(^DataTest(key),2) do $INCREMENT(count) quit:existscheck&&count } w !,"Count value is "_count
go to post Chris Stewart · Mar 26, 2024 This one will incorrectly flag an entry being in both lists if it appears twice in 1 list. That may not be possible due to constrants elsewhere, but it's something to be careful about
go to post Chris Stewart · Mar 26, 2024 I haven't put a massive amount of thought into this so it might be garbage for time/space complexity.... Set y = "Red, Green, Orange, Yellow" Set x = "Purple, Black, Yellow, Pink" set x=$ZSTRIP(x,"*W") set y=$ZSTRIP(y,"*W") k ^||members for i=1:1:$L(x,","){ set ^||Members($P(x,",",i),1)="" } for j=1:1:$L(y,","){ set ^||Members($P(y,",",j),2)="" } //Now do a quick traverse of our members set key="" set both="" for { set key=$O(^||Members(key)) quit:key="" set key2="" set key2=$O(^||Members(key,key2)) if ($O(^||Members(key,key2))'="" set both=both_key_"," } w !,"These records are in both lists "_both
go to post Chris Stewart · Mar 26, 2024 You absolutely can do this. Each namespace is set with a Globals DB and a Routines DB. The Globals are your default data storage, and the Routines are where your code lives Further to this, there are an array of mapping features allowing your data and code to be spread over multiple databases. You can read more about this here: https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
go to post Chris Stewart · Mar 21, 2024 Something like this would do it for i=1:1:$LENGTH(X,",") { w $PIECE(X,",",i),! }
go to post Chris Stewart · Jan 19, 2024 Now available at https://openexchange.intersystems.com/package/WidgetsDirector
go to post Chris Stewart · Dec 14, 2023 Having just done the same thing today, following Marc's comment (which is the same code in the documentation for MIMEParts) should get you what you need. As it stands, I'm pretty sure you are just passing a handle to a stream to the FormData, rather than referencing the content of the stream. This section of the example will correctly populate the HTTP Request body: // Write out Root MIME Element (containing sub-MIME parts) to HTTP Request Body. Set writer = ##class(%Net.MIMEWriter).%New() Set sc = writer.OutputToStream(tHttpRequest.EntityBody) if $$$ISERR(sc) {do $SYSTEM.Status.DisplayError(sc) Quit} Set sc = writer.WriteMIMEBody(rootMIME) if $$$ISERR(sc) {do $SYSTEM.Status.DisplayError(sc) Quit}
go to post Chris Stewart · Dec 7, 2023 In your example call, the top level is a JSON object, not an array so iterating over it won't work. You would need to access it from the children property However, he ZEN JSON functionality is deprecated in recent versions of IRIS, and the native JSON support is a bit friendlier to use. The documentation is here: https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls... If you use set obj = {}.%FromJSON(%request.HttpResponse.Data) you should get access to the json object, and then you can use %GetIterator to cycle over the array
go to post Chris Stewart · Nov 15, 2023 Great article! There are so many cool NLP possibilities using this framework
go to post Chris Stewart · Jun 9, 2023 HALT will exit any running IRIS Terminal session (though I tend to use H instead as HALT can also stop a Linux machine if you have already exited the IRIS Terminal)
go to post Chris Stewart · Nov 8, 2022 A handy way to find the process is to check your lock table. These processes will typically take out a lock based on the Task ID. This can be used to find the process, examine it and kill it if required. It's also possible in some cases for the process to die and not update the task, and this can account for no processes matching this criteria