Article Gevorg Arutiunian · Sep 13, 2018 1m read Find a table given its name The following code snippet includes a class method "test" that runs code to find a class based on the class's name. "test" takes one argument, which is the name of the table: Class objectscript.findTable Extends %RegisteredObject { classmethod test(name as %String="mytable") { #Dim result as %ResultSet #Dim tName as %String #Dim contain as %Integer Set contain=0 Set result = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary") Do result.Execute() While(result.Next()) { Set tName=$get(result.Data("Name")) &sql(select position (:name in :tName) into :contain) Write:contain'=0 tName, " ... ", name, " (", contain,")", ! } Return $$$OK } } Here's a link to the code on GitHub #Code Snippet #InterSystems IRIS #ObjectScript #Caché 2 6 0 758
Article Gevorg Arutiunian · Sep 6, 2018 1m read Save a file using %Net.HttpRequest This code snippet allows for a file on the web to be saved into the file system. Specify the server and GET request, as well as the directory the file should be saved to. The class method "test" runs the code: Class objectscript.saveFileHTTP Extends %RegisteredObject { classmethod test() { Set httprequest = ##class(%Net.HttpRequest).%New() Set httprequest.Server = "docs.intersystems.com" Do httprequest.Get("documentation/cache/20172/pdfs/GJSON.pdf") Do $System.OBJ.Dump(httprequest.HttpResponse) Set stream=##class(%FileBinaryStream).%New() Set stream.Filename="c:\test.pdf" Write stream.CopyFrom(httprequest.HttpResponse.Data) Write stream.%Save() } } Here's a link to the code on GitHub #Code Snippet #InterSystems IRIS #ObjectScript #Caché 3 0 1 986
Article Gevorg Arutiunian · Sep 4, 2018 11m read How I implemented GraphQL for InterSystems platforms I already talked about GraphQL and the ways of using it in this article. Now I am going to tell you about the tasks I was facing and the results that I managed to achieve in the process of implementing GraphQL for InterSystems platforms. What this article is about Generation of an AST for a GraphQL request and its validation Generation of documentation Generation of a response in the JSON format #API #REST API #Caché #Ensemble #HealthShare #InterSystems IRIS 6 2 2 1.1K
Article Gevorg Arutiunian · Aug 31, 2018 1m read Change all passwords in a system This code snippet changes all passwords in a system to a specified string. The two literal strings at the beginning of the snippet can be adjusted to edit the system or password string. The class method "test" runs the code: #Code Snippet #InterSystems IRIS #ObjectScript #Caché 3 7 0 744
Question Gevorg Arutiunian · Aug 23, 2018 Problem with generic classes using Java Gateway Hello, Currently, I'm working with a Java Gateway, and I have the following problem. When importing a class into IRIS, which uses methods from a generic class, I can not find the general methods I need. I'm talking about the test2 method from the class test. How can I import the java method that returns a generic? #Java #InterSystems IRIS #ObjectScript 1 2 0 317
Article Gevorg Arutiunian · Aug 22, 2018 1m read Get all filenames in a specified directory (Originally posted on Intersystems CODE by @Eduard Lebedyuk, 10/12/15) The following code snippet outputs all filenames in the file path "dir" in the Cache/IRIS terminal. The class method "test" runs the code: Class eduardlebedyuk.filenamesInDir Extends %RegisteredObject { classmethod test() { // replace dir with file path you want set dir = "D:\directory" set dir = ##class(%File).NormalizeDirectory(dir) set file=$ZSEARCH(dir_"*") while file'="" { write !,file set file=$ZSEARCH("") } } } #Code Snippet #InterSystems IRIS #ObjectScript #Caché 1 3 2 1.9K
Article Gevorg Arutiunian · Aug 16, 2018 2m read Routine to Parse Options in Args Array (Originally posted by Timur Safin on Intersystems CODE, 3/2/15) This code snippet is a routine that parses options saved in an arguments array. The subroutine "test" runs the code: #Code Snippet #InterSystems IRIS #ObjectScript #Caché 2 8 1 657
Article Gevorg Arutiunian · Jul 6, 2018 6m read GraphQL for InterSystems Data Platforms GraphQL is a standard for declaring data structures and methods of data access that serves as a middleware layer between the client and the server. If you’ve never heard about GraphQL, here is a couple of useful online resources: here, here and here. In this article, I will tell you how you can use GraphQL in your projects based on InterSystems technologies. #API #Caché #Ensemble #HealthShare #InterSystems IRIS 17 24 10 2.6K
Question Gevorg Arutiunian · Jun 13, 2017 Append a string to the beginning of a file How do I append a string to the beginning of a %FileCharacterStream in an existing file? #Object Data Model #Caché 1 5 0 1.1K
Question Gevorg Arutiunian · May 5, 2017 DeepSee Dimensions with list levels How can I do second dimension for the dimension, where we have comma delimited expression? #InterSystems IRIS BI (DeepSee) 1 4 0 328
Article Gevorg Arutiunian · Nov 21, 2016 5m read Caché Localization Manager or i18N in InterSystems Caché Caché Localization Manager CLM is a tool for localization/internationalization/adding multi-language support to a project based on InterSystems Caché. Imagine that you have a ready project where all the content is in Russian, and you need to add an English localization to it. You wrap all your strings into resources, translate them into English and call the necessary resource for Russian or English when necessary. Nothing tricky, if you think about it. But what if there are lots of strings and there are mistakes in Russian (or English)? What if you need to localize in more than one language – say, ten? This is exactly the kind of project where you should use CLM. It will help you localize the entire content of your project into the necessary language and retain the possibility to correct entries. #Frontend #Localization #Terminal #Tools #Caché 6 4 0 976