go to post Jean Millette · Apr 20, 2022 The "repr(ex)" Python method also prints a bit more information about the exception: except Exception as ex: print("Exception: %s" % str(ex)) print(repr(ex)) The "repr(ex)" Python method also prints a bit more information about the exception (e.g., the type of Error): Exception: division by zero ZeroDivisionError('division by zero')
go to post Jean Millette · Apr 20, 2022 If the goal is to have the method return an instance of %Exception.PythonException, the method could create one with "_New(str) method, supplying the "ex" string as the "str" parameter. The "except" clause would then return the instance. Not sure of the syntax, but it's likely something like this: newex = iris.cls('%Exception.PythonException')._New(ex) return newex If, instead of returning that exception, the method would rather "raise" the exception, there are some helpful hints here: https://stackoverflow.com/questions/2052390/manually-raising-throwing-an...
go to post Jean Millette · Apr 18, 2022 How about this? do ^%G (I tried to paste a screen shot, but no luck)...will try again, but the above command works to get you to the "Global ^" prompt.
go to post Jean Millette · Jan 6, 2022 Would be nice to add a parameter to %DisplayFormatted for specifying a separator character/string when the first parameter is "CSV". Until then, I'll go through the result set and use %Print("|") to use a non-tab, non-comma separator when exporting results with embedded commas as requested by a customer (they don't like tabs). Using Dynamic SQL | Using InterSystems SQL | InterSystems IRIS Data Platform 2021.1
go to post Jean Millette · Oct 28, 2021 Thanks Ben for the “shout out” and big thanks to you, @Matthew Giesmann, @Timothy Leavitt , @Philip Cantwell, @Paul Collins, and others on the AppServices and Trak teams for building key parts of the framework that enabled CCR’s move to InterSystems Reports.
go to post Jean Millette · Sep 15, 2021 Hello Rochdi, Have you resolved this? If not, are you using a report that is derived from %ZEN.Report.reportPage? If you are, you can use the "GenerateReport()" instance method to create an "xlsx" Excel file, which can then be exported to ".csv" after opening it from Excel. https://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?... Alternatively, the following code highlights how to generate a CSV file containing the results of a query: ClassMethod ExportCSV(/* some args */) As %String [ ZenMethod ] { /* get a results set named "rs" from a query (sql statement, or, in this example a query class): Set rs=##class(%ResultSet).%New("<some query class") Do rs.Prepare() Do rs.Execute(/*some args*/) */ // Define the delimeter to be used in CSV file (usually comma) Set Delim = "," // Define the file and its name Set File = ##class(%FileCharacterStream).%New() Set Filename = "filename.csv" Set File.BOM = $C(239,187,191) Set File.Filename = "C:\temp\"_Filename Set File.TranslateTable = "UTF8" // Define the names of the columns (should match up with the values in each row of the result // set. In this example, there are 3 columns Set FileHeader = $LB("Name","Rank","","SerialNumber") Do File.WriteLine($ZCVT($LTS(FileHeader, Delim), "O", "UTF8")) While rs.%Next() { Set Row = "" For i = 1:1:$LL(FileHeader) { Set col = $LG(FileHeader, i) Set Data = rs.%Get(col) // Replace characters that may mess up the CSV file (e.g., embedded commas in a data field) Set Data = $REPLACE(Data, $C(13), " ") Set Data = $REPLACE(Data, $C(10), " ") Set Data = $REPLACE(Data, """", "'") Set:(Data [ ",") Data = """"_Data_"""" Set Data = $ZCVT(Data, "O", "UTF8") // Add the datum to the row's list Set Row = Row_$LB(Data) } // Each element in the "row list" is written, separated by "Delim" (comma) on one line // in the file Do File.WriteLine($LTS(Row, Delim)) } // Set attributes of the file for easier reading by the right apps later. Do File.SetAttribute("ContentType","application/octet-stream; charset=utf-8") Do File.SetAttribute("ContentDisposition","attachment; filename="""_Filename_"""") Do File.SetAttribute("Expires",600) Do File.SetAttribute("Content-Length",File.Size) Do File.%Save() // Return the name of the full path to the CSV file Quit File.Filename } Please confirm if this is helpful or if you have other questions. Thank you
go to post Jean Millette · May 18, 2021 I've read that some users have seen the <MAXSTRING> error when they have "Log Trace Events" enabled for a particular business host. Can you try disabling this and re-running your program? http://docs.intersystems.com/ens201317/csp/docbook/DocBook.UI.Page.cls?K...
go to post Jean Millette · May 10, 2021 The AppS.REST Framework, described here: https://community.intersystems.com/post/appsrest-new-rest-framework-inte..., provides hooks for authentication (see "AuthenticationStrategy()" and "GetUserResource()" methods in AppS.REST.Handler class). You can use these hooks with the following "LDAP" package to interact with an LDAP database programmatically: https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...
go to post Jean Millette · May 10, 2021 The above solution is great if you’d like to keep the list in each record of one table. Depending on the nature of the data in your application, another option is to “normalize” the data a bit and create a separate table for the “numDossiersMER” values and link them back to the original “Titre” table as follows. Convert the planned updated table from this: User.TestList.Data.Titre numTitre millesime codeProduit numDossiersMER (list) 1 2021 X 1 2 3 2 2021 X 4 5 6 3 2021 X 4 2 3 4 2022 X 2 5 7 8 To the following 2 normalized tables User.TestList.Data.TitreNew Id (IRIS) numTitre millesime codeProduit 1 1 2021 X 2 2 2021 X 3 3 2021 X 4 4 2022 X User.TestList.Data.DossierMER Id (IRIS) titreID numDossierMER 1 1 1 2 1 2 3 1 3 4 2 4 5 2 5 6 2 6 7 3 4 8 3 2 9 3 3 10 4 2 11 4 5 12 4 7 13 4 8 The “id (IRIS)” in each table is the “ROWID” assigned by IRIS as each entry is created in the table. Using these two tables, the following “JOIN” query will get the results to be formatted as you like: select numTitre, millesime, codeProduit, numDossierMER from User_TestList_Data.TitreNew t JOIN User_TestList_Data.DossierMER d on d.TitreId = t.id Please note that this “normalized” solution is great if the “numDossierMER” values can be shared among various “Titre” records as shown in my made-up example above. Sample code here: Class User.TitreNew Extends (%Persistent, %Populate) { Property numTitre As %Integer; Property millesime As %Integer; Property codeProduit As %String; Index titreIdx On (numTitre, millesime, codeProduit) [ PrimaryKey ]; } Class User.DossierMER Extends (%Persistent, %Populate) { Property titreID As %Integer; Property numDossierMER As %Integer; } (Please excuse the formatting)
go to post Jean Millette · Mar 29, 2021 The WRC site has a page to search for and download components like ODBC drivers for all ISC versions: https://wrc.intersystems.com/wrc/coDistGen.csp
go to post Jean Millette · Oct 7, 2020 Thank you Evgeny and Stefan, very helpful. A minor note: There is a typo at the end of the control panel url (cspv->csp).
go to post Jean Millette · May 27, 2020 Please disregard my previous reply. https://cedocs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GZAP_page_really_programming#GZAP_client_functions
go to post Jean Millette · Oct 8, 2019 You're welcome Ting! Hope you figure out the issue with the code. Best, Jean
go to post Jean Millette · Oct 8, 2019 Hi Ting, I haven't "Viewed Other Code" in Eclipse, but in Studio, Control-G will bring up the "Go To" dialog box. You can click the "Tag or Label" option and type in zProcessRequest+8 into the text field and it should take you to the line in question. (If there is a similar feature in Eclipse) Jean
go to post Jean Millette · Sep 24, 2019 Hi Gunwant, I can't think of any additional settings off the top of my head. But here is a link that describes some things that you can try (e.g., making sure "UnknownUser" is enabled and license is all set): https://community.intersystems.com/post/service-unavailable-while-invoke-rest-url Hope this helps, Jean
go to post Jean Millette · Sep 24, 2019 Hello Gunwant, Can we assume that you've set up a Web Application named "/widgetsdirect/rest" via the Management Portal? I've compiled your code and tested it and it works for me: Best, Jean
go to post Jean Millette · Aug 23, 2019 Bonjour Michel,Thank you for your response. I'm not sure how one would delete query plans. Furthermore, I'm not sure how one would identify the query plans that used a new index.35 seconds were indeed very important, especially for a REST service because the user needed to wait that long for the browser to respond.The code that benefited from the new index looks at two tables of similar size, about 160K records. The method needs to look at every record in the first table to find records that match certain criteria. Then for each of those matching records, visit every record in the second table to find records that match other criteria (Order N-squared).Adding the index to the 2nd table brought the number of checks down to "Order N".After the change, the wait for a response at the user's browser is negligible.
go to post Jean Millette · Aug 23, 2019 You're welcome Alex. I had no experience purging cached queries, so I ran a little experiment and confirmed that purging cached queries does NOT unfreeze query plans:1. I froze all the plans:do $system.SQL.FreezePlans(1,1)2. I confirmed query plans were frozen using the Management Portal:3. I then purged the Cached Queries for the specific table (crm.Company):do $system.SQL.PurgeForTable("crm.Company")4. And confirmed that the Cached SQL Queries were gone, again, using Management Portal:5. Checking the frozen plans again post-purge, we see the query plans are still there, still frozen: Hope this helps.
go to post Jean Millette · Feb 12, 2018 Congratulations Robert! I'm always learning from you and looking forward to more opportunities to do so on the DC. All the best to you!