go to post Eduard Lebedyuk · Jul 17, 2019 Should be If glo["ABC",type="K" Set restmode=0 /*except if a kill on ^ABC*/ Instead of If glo["^ABC",type="K" Set restmode=0 /*except if a kill on ^ABC*/
go to post Eduard Lebedyuk · Jul 17, 2019 Globals can't have duplicate keys.After I execute your code and call zw ^Data I get this output: ^Data("Athens")=7 ^Data("Boston")=3 ^Data("Cambridge")=1 ^Data("London")=4 ^Data("New York")=2
go to post Eduard Lebedyuk · Jul 17, 2019 Please post CROSRestAPI as text.Can you get InterSystems IRIS or a complete version of Cache/Ensemble?Service Unavailable error is because of license limitations on TRYCACHE.
go to post Eduard Lebedyuk · Jul 16, 2019 Create a response wrapper and use it. %ListOfObjects is serial, not persistent. Class MyResponse Extends %Persistent { Property Snapshots As List Of EnsLib.SQL.Snapshot; }
go to post Eduard Lebedyuk · Jul 16, 2019 Well, maybe it's a handwritten response?I'd recommend contacting the API developer and verifying that API responses would be indeed JSON.
go to post Eduard Lebedyuk · Jul 16, 2019 Can you make the same call to the API using Postman and show the response?It's very strange that API returns non-json response.Does my code snippet throw the same error?
go to post Eduard Lebedyuk · Jul 16, 2019 You can simplify your code to this: set dynObj = {}.%FromJSON(objHttpResponse.Data) set iter = dynObj.%GetIterator() while iter.%GetNext(.key , .value ) { write "key = "_key_" , value = "_value,! } Also json is a string so in your code sample it won't have %FromJSON method.
go to post Eduard Lebedyuk · Jul 16, 2019 Well, the JSON you posted is not a valid JSON. Where did you get it?Valid JSON looks like this: { "error":[ { "txt1":"error msg1" }, { "txt2":"error msg2" } ] }
go to post Eduard Lebedyuk · Jul 16, 2019 What version are you on?If it's 2016.2+ you can use dynamic objects.
go to post Eduard Lebedyuk · Jul 16, 2019 1.Variables are defined or referenced via <var>, yes, but you can pass the values to the Installer from your script. For example, check MDX2JSON installer: Set pVars("User")="web" Set pVars("Password")="dsweb" Set pVars("Namespace")="TEMP3" Set pVars("Import")=1 Set pVars("SourceDir")="C:\temp\MDX2JSON\MDX2JSON" Do ##class(MDX2JSON.Installer).setup(.pVars) 2. You set environment variable in cmd (Windows): set NEWVAR=SOMETHING And after that you can get it from installer with: $system.Util.GetEnviron("NEWVAR")
go to post Eduard Lebedyuk · Jul 16, 2019 1. You can pass variables to installation manifest.2. You can set environment variables and get them in ObjectScript: set env = "MYVAR" set val = $system.Util.GetEnviron(env)
go to post Eduard Lebedyuk · Jul 15, 2019 They go through your web server (i.e. Apache, NodeJS, IIS) directly.You can serve files via REST, from files or XDatas. Here's an example in WebTerminal app, but it can be generalized to server arbitrary files from FS.
go to post Eduard Lebedyuk · Jul 14, 2019 That would work only in the cases where original reference to OREF exists, right?
go to post Eduard Lebedyuk · Jul 11, 2019 i was able to convert the HttpResponse.Data to String and than to the Dynamic ObjectYou don't need to convert to string, pass stream to FromJSON method and it would work.send a JSON data to a REST API. Set tAge = 23 Set pRequest= {"name":"abcdefghi","salary":123,"age":(tAge) }
go to post Eduard Lebedyuk · Jul 11, 2019 What version are you on? If 2016.2+ then you can convert JSON stream to dynamic object via: set dynObj = {}.%FromJSON(req.HttpResponse.Data)
go to post Eduard Lebedyuk · Jun 29, 2019 It sets object id directly instead of setting oref.Consider these 2 classes: Class Person Extents %Persistent { Property EmployedAt As Company; } Class Company Extends %Persistent { } Usually you assign Company to Person this way: set person = ##class(Person).%New() set companyId = 123 set company = ##class(Company).%OpenId(companyId) set person.EmployedAt = company But with PropertySetObjectId you can expedite things set person = ##class(Person).%New() set companyId = 123 do person.EmployedAtSetObjectId(companyId) The main advantage is that company object doesn't have to be opened.