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.cls...

set internaldate = $ZDATETIMEH(input,3)

set outputdate = $ZDATE(internaldate,8)

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

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

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}