go to post David Hockenbroch · Feb 18, 2022 Here's how I've been doing this: //Read in content from the HttpRequest set req = %request.Content.Read() //Convert content from JSON to a dynamic object set reqObj = {}.%FromJSON(req) //Access data from within the new dynamic object set userName = reqObj.%Get("UserName")
go to post David Hockenbroch · Feb 8, 2022 Why not do this? set rset1 = ##class(%ResultSet).%New() set query = "Select statment" set sc = rset1.Prepare(query) set:+sc sc = rset1.Execute(parm1, parm2) set ^sql = query
go to post David Hockenbroch · Feb 7, 2022 Have you checked the security settings for the user you're logging in as? You should have %Developer and %DB_USER, I think. Or if you have %All, that works too.
go to post David Hockenbroch · Jan 7, 2022 This is a long shot, but is the ODBC connection defined in User DSN or System DSN? We had an issue after a recent round of Windows updates where Excel suddenly wasn't always correctly seeing the System DSN connection, and setting it up under User DSN instead resolved that issue.
go to post David Hockenbroch · Jan 7, 2022 Here is some useful documentation. You're going to want to make a class that extends %CSP.REST and set up an application that uses that class as its dispatch class. You'll have a URL map in that class to tell IRIS or Cache what to do with the request. Depending on your specific application, you might also want to get familiar with using %request and %response in that process.
go to post David Hockenbroch · Dec 22, 2021 If you're using the IRIS ODBC driver, try switching to the IRIS ODBC35 driver. This kind of error may mean that the application is expecting the driver to do some ODBC 3.x stuff that the older driver might not be capable of.
go to post David Hockenbroch · Dec 22, 2021 The ones in italics are the ones that are a part of your current project. If you click on the Project tab, they'll show up there too.
go to post David Hockenbroch · Dec 1, 2021 ..Adapter.SSLConfig should get you the name of the SSL Configuration that the adapter is using. The property of the %Net.HttpRequest is called SSLConfiguration. So it should be: set httpRequest.SSLConfiguration = ..Adapter.SSLConfig
go to post David Hockenbroch · Nov 29, 2021 You can use $ZSTRIP for this, in your case: $ZSTRIP("Happy new year ","<>W")
go to post David Hockenbroch · Nov 17, 2021 You're exactly right; by default, the contents of the dataCombo are empty until the user clicks on it, then the query gets executed. If you set the cached property of the dataCombo to 1, it'll load as soon as the page loads instead.
go to post David Hockenbroch · Nov 16, 2021 Rochdi, when you say you've figured out how to save it to C:\Temp\filename.csv, are you saying you have it saved on the client, or on the server? If it's saving the file on the server, you can create a class that extends %CSP.StreamServer, then override the OnPreHTTP and OnPage class methods like this for simple text files: Class fileserver Extends %CSP.StreamServer { ClassMethod OnPreHTTP() As %Boolean { do %response.SetHeader("Content-Type","text/csv") do %response.SetHeader("Content-Disposition","attachment;filename=""myfile.csv""") quit 1 } ClassMethod OnPage() As %Status { set file = ##class(%File).%New("/path/to/file.csv") do file.Open("R") while file.AtEnd '= 1{ write file.ReadLine(),! } quit $$$OK } } and then just link to it that page to download. Once you get to things that aren't plain text, it gets a little more complicated, but this should work for a simple csv.
go to post David Hockenbroch · Nov 5, 2021 Your result set should be an EnsLib.SQL.GatewayResultSet, which has a method called GetSnapshot(). That method has you pass a EnsLib.SQL.Snapshot by reference. You're probably going to want to set the FetchAll parameter on the GetSnapshot() method to 1 so it gets all the results, but you can also create your EnsLib.SQL.Snapshot before using GetSnapshot() and set it's starting row and max rows if you'd like. Then you can iterate over the snapshot instead of the result set. Once you've gone through it once, you could either create a new snapshot by calling the GetSnapshot() method again, or you can use the snapshot's Rewind() method.
go to post David Hockenbroch · Nov 4, 2021 According to this page, if it's something that still in development, you can use the CleanProduction() method to clear the message queues. Using it in a live system isn't recommended because it clears out everything pretty indiscriminately, but it's useful for debugging. Productions get the suspend status when after shutting down there are still synchronous messages that could not be processed.
go to post David Hockenbroch · Nov 2, 2021 You'll need the resource %Admin_Task to use task manager functions. Once you have access to it, set up a class that extends %SYS.Task.Definition and override the OnTask() method. Then you can set it up in the task scheduler and it'll run the OnTask() method according to whatever schedule you set.
go to post David Hockenbroch · Oct 7, 2021 At the bottom of the pane you showed in your screenshot, there should be a few tabs. If you're on the "Project" tab and haven't added any classes to your project, it would look like that. If you switch it to the "Namespace" tab, you should see everything.
go to post David Hockenbroch · Sep 24, 2021 MAXSTRING usually indicates that you're exceeding the maximum possible length of a string somewhere. Are you sure it's a problem with the %Stream.GlobalCharacter, and not a different string variable in your program? Global character streams shouldn't have that problem. You can see what the maximum length of a string is on your system by opening a terminal and running: write $SYSTEM.SYS.MaxLocalLength()
go to post David Hockenbroch · Sep 24, 2021 One of the properties of the %SOAP.WebClient class is HttpRequest which is an instance of %Net.HttpRequest. You might need to set the content type of that HttpRequest. So where you have "..ContentType", try "..HttpRequest.ContentType"?
go to post David Hockenbroch · Aug 19, 2021 The maximum URI size in Apache is usually 8,177 characters, but increasing that isn't the problem. Somewhere in your program, the value of your input is getting appended onto the URI, and it shouldn't be. Can you see anywhere that your program might be doing that?
go to post David Hockenbroch · Jul 27, 2021 I've had some time to try this now. Here are steps that worked for me: set myrequest = ##class(%Net.HttpRequest).%New() set myrequest.Server = "<server ip or domain here>" set myrequest.Port = "<server port here if it isn't 80>" set myrequest.Location = "</path/to/rest>" do myrequest.EntityBody.Write("<your json here>") do myrequest.Post() set mydata = myrequest.HttpResponse.Data.Read() At that point, the data returned in the response should be in mydata. Depending on your specific API, you made need to take additional steps for authentication, and you may need to use myrequest.Get() or myrequest.Put() instead of myrequest.Post(). If you need to set parameters, you use the SetParam method of the HttpRequest. For example, if you're using the very most basic way to authenticate to a Cache instance, you do that by specifying a CacheUserName and a CachePassword as parameters as follows any time before your post/put/get: do myrequest.SetParam("CacheUserName","<your username here>") do myrequest.SetParam("CachePassword","<your password here>")
go to post David Hockenbroch · Jul 21, 2021 If your other system is also a Cache or IRIS server, there is a mirroring options called a reporting async that exists for this specific purpose. If you've got multiple servers and need to consolidate that data for reporting purposes, a reporting async can be a part of up to 10 mirrors to help you bring that data together, too.