go to post Robert Cemper · May 22, 2022 Do you expect to save #1) the input JSON object or#2) a dump of the converted result?For both: set stream=##class( %Stream.GlobalCharacter).%New() #1) with myjson as your JSON input do stream.Write(myjson) do stream.%Save() #2) dump the generated Object obj using my package Full-OBJ-Dump described here do ##class(Z.obj).dumpToStream(.stream,obj,1) do stream.%Save()
go to post Robert Cemper · May 18, 2022 Take a closer look to Caché I/O Device Guideespecially Chapter 5: TCP Client/Server Communication
go to post Robert Cemper · May 17, 2022 As you operate on 2014.* just write it down as any other string. after 2017.1 you may (but are not forced to) use %DynamicObjects and %%DynamicArrays.but the result looks the same
go to post Robert Cemper · May 17, 2022 Status= 1 justteslls you tht the HTTP connection was processed OK.Next you need to take a look into your response object. set res=Httprequest.HttpResponsein terminal then ZW res to see in the Status is 200 OKotherwise what you see I res.Data might be just an error page.Which is also OK for HTTP but not for your content. • property ReasonPhrase as %String; This is the human readable reason that goes with the StatusCode. • property StatusCode as %Integer; The HTTP status code. This is useful to determine if the request was successful. Look in the rfc for HTTP to see which codes are supported and what they mean. A human readable form of this code is stored as the ReasonPhrase • property StatusLine as %String; The HTTP status line. This is the first line of the response and signals if the request was successful or if there was a problem.
go to post Robert Cemper · May 17, 2022 I found %DynamicObjects first in Caché 2017.1 Class Refhttps://cedocs.intersystems.com/ens20171/csp/documatic/%25CSP.Documatic.cls?&LIBRARY=%25SYS&CLASSNAME=%25Library.DynamicObjectIn 2014 this was somehow buried in %ZAN.Auxilary.???
go to post Robert Cemper · May 8, 2022 You might take a look to this article Global archiver - Moving a part of a global.And the related package in OEX global-archiver
go to post Robert Cemper · May 6, 2022 Now with the class definition available, I understand(?) what you are looking for.I see 2 possible solutions: embedded SQL or an Index on Title#1 ClassMethod TitleToRowId(title) As %String [ PublicList = (title, rowid, SQLCODE) ]{ &SQL( SELECT RowId into :rowid FROM REST.TITLE WHERE Title = :title ) if 'SQLCODE quit rowid quit SQLCODE} btw: SQLCODE=0 means success. and you get the RowId by SET RowId=##class(REST.TITLE).TitleToRowId(obj.Title) ;obj=JSON SET task.Title = ##class(RESTAPI.TITLE).%OpenId(RowId) SET book.Title = ##class(RESTAPI.TITLE).%OpenId(RowId) ; recent example #2 creating an Index on Title in REST.TITLE. but you have all trouble on duplicates, max. string length on that index So I'd position it as elegant but rather risky on maintenance
go to post Robert Cemper · May 5, 2022 the story is clear. Your class definition is not.once more pls show class definitions for RESTAPI.TITLE and ??.BOOK (every class has also a package, default is User) you may need Studio od VSCode to see it. and {"ID":17, "Title":"LEARNING CAHE REST API"} is aDynamic JSON object unrelated to any class definition
go to post Robert Cemper · May 3, 2022 so your obj is a DynamicObject and looks something like { "ID":17, "Title": 44 } class All.Allbooks has this Property Title As User.Book. To set it you need an oref !! therefore to create the required oref : SET task.Title = ##class(User.Book).%OpenId(obj.Title)
go to post Robert Cemper · May 2, 2022 I guess you look for this: ClassMethod GetABookById(id As %Integer) As %Status { SET MyBooks = ##class(All.Allbooks).%OpenId(id) SET obj={} set obj.ID=MyBooks.%Id() set obj.Title=MyBooks.Title WRITE obj.%ToJSON() Quit 1 } ATTENTION:MyBooks.Title is just a reference to User.Book
go to post Robert Cemper · Apr 26, 2022 namespace %SYS ?all required privileges ? Checked Class Docu for 2017.1 >>> query Detail exists ! https://cedocs.intersystems.com/ens20171/csp/documatic/%25CSP.Documatic.cls
go to post Robert Cemper · Apr 26, 2022 this worked for me select CAST(0+AVG(PackingTimeSpent) as TIME) average .... the 0+ forces Integer, then CAST understands youand pls. don't ask why. I just tried the output from AVG() is definitely NOT Integer
go to post Robert Cemper · Apr 25, 2022 this are not properties but an ERROR Status Object.the boxes are non-printable binary values from $LB() or similar.
go to post Robert Cemper · Apr 17, 2022 You are right.But it works in a test within a Try-Catch bloxk try { ;;; run your code } catch e { if $ze["<RESJOB>" while $TLEVEL { tcommit } }
go to post Robert Cemper · Apr 10, 2022 Do you still expect some echo?Or is the question meanwhile just out of date?
go to post Robert Cemper · Apr 3, 2022 To force it to string you have to append some non numeric character ! but this one is then part of the subscript as $c(0) or whatever you appendin addition, you break the numeric sort and change to string sorting. USER>set s1=111,s2=444,q="." USER>set a(s2)=1,a(s1)=2,a(s1_q)=3,a(s2_q)=4 USER>zw a a(44)=1 a(111)=2 a("111.")=3 a("44.")=4
go to post Robert Cemper · Apr 2, 2022 Do you still expect some echo?Or is the question meanwhile just out of date?
go to post Robert Cemper · Apr 2, 2022 Do you still expect some echo?Or is the question meanwhile just out of date?
go to post Robert Cemper · Apr 2, 2022 USER>set s1=111,s2=444 USER>set a(s2_$c(0),s1_$c(0))=77 USER>set a($c(0)_s1,$c(0)_s2)=99 USER>zwrite a("111","444")=99 a("444","111")=77 s1=111 s2=444 USER> "save it from the class " ? whatever that may mean .... ?
go to post Robert Cemper · Mar 30, 2022 An object might not fit well a Global with a reasonable number of nodes.But by SQL you get it line by line. check this: Show Global by SQL SELECT