go to post David Hockenbroch · Jul 29, 2022 You can probably make that work, but why not put the method in a %CSP.REST class to start with and have the CSP page call it? That seems more in line with the way those things are meant to be used.
go to post David Hockenbroch · Jul 18, 2022 I think what you're looking for might be setting the isolation level to read committed. This will make the process wait for the in-progress changes have been committed, though you'll still want to make sure you handle SQLCODE -114 somehow, too. That's the code you get back if there's a timeout waiting for the lock. You should be able to set that using: %SYSTEM.SQL.Util.SetOption("IsolationMode",1,.oldval) If you do that before your query, the rest of the process will run at that isolation level. You can use that same method to set the LockTimeout too, by the way. Default is 10 seconds.
go to post David Hockenbroch · Jul 18, 2022 The error seems to occur when it's trying to access the log file. Under you advanced settings, have you checked where it's trying to find or create your log file and made sure it's valid?
go to post David Hockenbroch · Jun 6, 2022 Double check your IP address and port in the settings on the Preferred Server menu.
go to post David Hockenbroch · May 31, 2022 It sounds to me like there's an issue with the design there. If the field can be duplicated, why is it marked as unique at all?
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 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 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 · 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 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 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.