Chris Stewart · Jun 13, 2024 go to post

Hi Krishnaveni


There are 2 answers to this. The easy but wrong way , and the more correct way


The easy way would be to take the piece of the string before the space character, and then remove all nonNumeric chars

set output = $ZSTRIP($PIECE(input," ",1),"*AP")

The better was is to convert to the canonical date format, then convert back to the format you want.  Relevant documentation page: https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cl…

set internaldate = $ZDATETIMEH(input,3)

set outputdate = $ZDATE(internaldate,8)
Chris Stewart · Jun 3, 2024 go to post

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
Chris Stewart · Apr 18, 2024 go to post

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
Chris Stewart · Mar 26, 2024 go to post

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

Chris Stewart · Mar 26, 2024 go to post

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
Chris Stewart · Mar 21, 2024 go to post

Something like this would do it

for i=1:1:$LENGTH(X,",") {

   w $PIECE(X,",",i),!
}
Chris Stewart · Dec 14, 2023 go to post

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}
Chris Stewart · Dec 7, 2023 go to post

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.cl…

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 

Chris Stewart · Nov 15, 2023 go to post

Great article!  There are so many cool NLP possibilities using this framework

Chris Stewart · Jun 9, 2023 go to post

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)

Chris Stewart · Nov 8, 2022 go to post

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

Chris Stewart · Sep 16, 2022 go to post

Based on this error: SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure , you probably want to enable SSLv3 on your SSLConfig. It's showing as disabled in your screenshot

Chris Stewart · Jul 22, 2022 go to post

This type of request is handled via your contract arrangements, so the best route is to engage your support service who will be happy to get you the assistance you require

Chris Stewart · Jul 22, 2022 go to post

Hi Ramil

This sort of request is handled by your account with Trakcare support.   I would recommend you engage with your local support team using iService to proceed with this requirement

Chris Stewart · Apr 7, 2022 go to post

If only seeing new data suits your use case, then you are probably ok with this approach.   You may wish to look at %ValidateIndices() which I believe is present in Cache2018.   This will allow an online check of the index state and can either report on mismatches, or be set to autorepair.  It is MUCH slower than a %BuildIndices, but does not require a full freeze for safety

https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KE…

Chris Stewart · Feb 18, 2022 go to post

Hi Token

I think this might be case senstivity, try using %request.Content and see if that works better?

Regards

Chris

Chris Stewart · Dec 15, 2021 go to post

Great new feature!   Even more glad to hear there is no work required to use it after we upgrade

Chris Stewart · Sep 8, 2021 go to post

HI Ben, 


I believe this is implemented specifically on each mail server and client, so there is no standard for it: See https://www.chilkatsoft.com/p/p_471.asp for details

You can set these headers, but there's no guarantee the client or receiving server will take note of them

HTH

Chris

Chris Stewart · Feb 23, 2021 go to post

Hi Julius

Thanks for your comments, and you are correct in assessing this is for a specific use case (I'm migrating data between 2 structures and want to make sure the exported JSON is EXACTLY the same).

For the first point, I really only care that all values in the source are also in the target.   If I wanted to be thorough, I woudl run the compare in both directions, but since I'm expecting that the target will contain additional properties, I only need a 1 way compare)

For the second point, I actually define the ordering of exporting of arrays explicitly, so I would expect a like for like compare.   For other cases, additional logic would need to be added, as you pointed out

For the last point,  this should return a mismatch, which is good enough for my use case, but again, might not be ideal for other use cases