go to post David Hockenbroch · May 31, 2022 Rochdi, I'd get rid of: Set Line = File.Read(1000)While (File.Read(1000)'="") { S mystring=mystring_File.Read(1000)} And then after your set Httprequest = ##class(%Net.HttpRequest).%New(), use: set sc = Httprequest.EntityBody.CopyFromAndSave(File) Then you can check sc to see if you got any errors doing that.
go to post David Hockenbroch · May 31, 2022 Your tResult will have a property called %SQLCODE that gets set when the query is run. If %SQLCODE = 100, that means that the query ran successfully but returned no results or that you've reached the end of the result set. If %SQLCODE = 0, you have some results. If %SQLCODE is less than zero, that's an error code. if tResult.%SQLCODE = 100{ //whatever you want to do for no results here }
go to post David Hockenbroch · May 27, 2022 If you're encoding your data before sending it, you have to specify how it was encoded in a content encoding header so that the server you're sending data to knows how to decode it. I think it's more likely, though, that it's an issue with your content type. Where you're setting it to "text/plain", if it's supposed to be json, you might try setting it to "application/json" instead.
go to post David Hockenbroch · May 27, 2022 How certain are you that the server you're sending the request to accepts a content type of "text/plain"? Having that wrong, or using the wrong encoding are probably the most common causes of a 415 error.
go to post David Hockenbroch · May 18, 2022 If the file isn't accessible to link to directly, you may want to look into extending the %CSP.StreamServer class and linking to that. At a bare minimum, you'll want to override the OnPage and OnPreHTTP methods: ClassMethod OnPage() As %Status{set myfile = ##class(%File).%New("/path/to/file")do myfile.Open("S")do myfile.OutputToDevice()quit $$$OK} ClassMethod OnPreHTTP() As %Boolean [ Language = cache ]{do %response.SetHeader("Content-Disposition","attachment;filename=""filename""")quit 1} Of course using your own file name and the path to the file. That's the local computer file path, not a URL. You also should set the content type appropriately using set %response.ContentType = "text/csv" or whatever the MIME type of the file is so that the browser can identify it correctly. Unless you want to have to write another %CSP.StreamServer for every file, you'll have to pass the name of the filepath as an argument. So that would look more like: ClassMethod OnPage() As %Status{set myfile = ##class(%File).%New(%request.Get("filepath"))do myfile.Open("S")do myfile.OutputToDevice()quit $$$OK} ClassMethod OnPreHTTP() As %Boolean [ Language = cache ]{set filepath = %request.Get("filepath")set %response.ContentType = "text/csv" //or whatever the appropriate MIME type isdo %response.SetHeader("Content-Disposition","attachment;filename="""_$P(filepath,"/",*)_"""")quit 1} Then you could link to it as whatever the path to your stream server is with ?filepath=/path/to/file on the end. If you take that approach, though, do some validation on the filepath and make sure it can ONLY go to the folder you want! Or, only pass the filename as a parameter to the page, and hard-code the folder in those methods.
go to post David Hockenbroch · May 18, 2022 It looks like in your curl you have the Accept header as */*, but in your HttpRequest object, you're setting it to "application/json". Does that make a difference?
go to post David Hockenbroch · May 17, 2022 Even in the global masters rewards where they have an RPi available with IRIS preinstalled, it's running on Ubuntu, not Raspbian, so that part didn't surprise me. As python becomes more widely adopted in IRIS and word gets out about it, I won't be surprised if some of the RPi community shows up with some pretty cool projects using IRIS Community since a lot of them are python developers. InterSystems tends to lean into health care as the main thing, but there you've got a device that you can connect all kinds of sensors and gizmos to that may lend themselves well to other fields. Let's not be hasty dismissing it because it can't run an entire hospital.
go to post David Hockenbroch · May 16, 2022 In addition to the methods already mentioned, a lot of the %Library classes also have a class method called IsValid that you can use. For instance if ##class(%Numeric).IsValid(n) returns a 1, then n is a valid numeric value.
go to post David Hockenbroch · May 12, 2022 Are you sure you copied in the right SQL queries in your post? The ones you've included both try to update the EmailOptIn column to 0 where it's already set to 1, not where it's null. It seems to be they should be something more like "update Person set EmailOptIn = 0 where EmailOptIn is null".
go to post David Hockenbroch · May 9, 2022 Are you just trying to get the json contained in a character stream into a string a vice versa? If so, just read and write to and from the stream: set json = "" while 'stream.AtEnd { set json = json_stream.Read() } That should get you the contents of the stream into a string. do stream.Write(json) That should write the json to a stream. Or is that not what you're trying to do?
go to post David Hockenbroch · May 5, 2022 Methods that return a %Status don't automatically throw an exception. You have to check if the %Status is an error and throw it yourself. After your SendFormDataURL call, you might want to add the following and see if that gives you any more information: if $$$ISERR(st) { throw ##class(%Exception.StatusException).CreateFromStatus(st) } However given that the HTTP status of the response is a 500 (an internal server error) there may also be a problem on that end.
go to post David Hockenbroch · Apr 27, 2022 There isn't a hard limit on the number of tasks, but you may run into licensing issues. As you set them up, you choose the user they run as, so if that user has too many connections going at once, or if they're run as more different users than you have licenses for, there could be an issue.
go to post David Hockenbroch · Apr 5, 2022 I'm not sure your question is clear, but creating a new instance of that class in ObjectScript should be as simple as: set myDTL = ##class(Ens.DataTransformDTL).%New()
go to post David Hockenbroch · Apr 1, 2022 Once you know the pid, try: set process = ##class(%SYS.ProcessQuery).%OpenId(pid) Then check process.Routine, or process.CurrentLineAndRoutine.
go to post David Hockenbroch · Feb 28, 2022 Unless I'm setting type=1, I do need the user's password still to do this, right?
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 11, 2022 Eduard, can't the MAXSTRING one also mean that you've exceeded a specified MAXLEN parameter on a string? Like if I have a Property LastName As %String (MAXLEN = 30) and you try to save the object with a 50 character last name, doesn't that also give a "MAXSTRING" error?
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 · Feb 1, 2022 Are you trying for the Cache driver, or the IRIS driver? I'm pretty sure the 3.0.0 jar you're using is an IRIS driver, and in that case, the driver is com.intersystems.jdbc.IRISDriver, not com.intersys.jdbc.CacheDriver (note that in that transition, the beginning of the package changed from com.intersys to com.intersystems.)