查找

Artigo
· 2 hr atrás 6min de leitura

Git Integration for the Absolute Beginner: Source Control Best Practices with IRIS through VSCode

Table of content

  1. Inroduction
  2. Version Control
  3. Exporting Classes
  4. Exporting BI Analytics clases
  5. Exporting globals

Introduction.

In this article, we'll cover a quick start to Git development with the InterSystems Developer Community and version control practices when working with IRIS InterSystems. We'll cover scenarios where we need to export Interoperability classes, globals, and analytics elements such as cubes and dashboards. These scenarios encompass key version control practices with IRIS.

To get started, you'll need:

  1. Register and log in to GitHub
  2. Be a member of the intersystems-community organization on Git

Getting started with IRIS InterSystems is very simple!

Version control with IRIS is fundamentally no different from any other project. We make changes to files and commit them to the repository. With IRIS InterSystems, сhanges made in IRIS are not exported to the external file system automatically, we need specialized tools for that.

Let's start by creating a repository and uploading your code to it.

To get started, go to github.com and create an empty repository. You'll be prompted to name it, select privacy settings, and use the template intersystems-community/iris-interoperability-template (this is possible if you're part of the InterSystems Community organization).

- This template contains everything you need to quickly get started with IRIS and its core systems: interoperability classes, globals, and data classes for working with analytics. You can also use this template to follow along with me. -

Fill in the appropriate fields and click Create repository

 

Done! Now we have a repository. Next, we just need to clone it to our hard drive, build a Docker container with the IRIS image, and start coding.

Clone the repository to the file system. Then open Microsoft Visual Studio and navigate to the directory containing the code.

Next, we build our project.

docker compose build - -no-cache - -progress=plain

And then

docker compose up -d

That's it, the installation and launch of your project is complete.

Version control.

To commit your project changes to the repository, you need to check them out of the container and into the working directory. To track changes in IRIS, use the git-source-control application. It allows you to monitor the state of files within the IRIS filesystem without any additional configuration and check them out each time you make changes.

Our template already has the git-source-control package pre-installed, so we can see how it works and focus on version control. The package is installed in the iris.cls file. Note these lines:

zpm "install git-source-control"
do ##class(%Studio.SourceControl.Interface).SourceControlClassSet("SourceControl.Git.Extension")


The first line is installing the application from InterSystems Package Manager or IMP (ex: ZPM). The second line sets the git-source-control application class: "SourceControl.Git.Extension" as an argument to the %Studio.SourceControl.Interface system class, which allows VSCode to communicate with the source control class. This configuration is done when building the container in the dockerfile or installer.cls, or in this case, in iris.cls.

Exporting classes.

Now let's try making some changes to our code and see what happens. We'll create a data cube for one of the tables provided in this template. To do this, enable analytics for the current namespace by running the following command in the console:

do EnableDeepSee^%SYS.cspServer("/csp/USER/")

After that, we go to the address Management Portal->Analytics->Architect and we will see this window:

 

Click New and fill in the fields in the form to create a new cube. For our cube, we'll use the dc.Demo.PostMessages data model.

 

This is approximately the result you should get.

 

Then we save and compile the new cube.

 
Let's go back to VSCode and see what has changed.

 
The new cube is uploaded to the file system exactly as we created it! It's that simple. Next, we'll modify one of the business production classes.

Go to IRIS and navigate to Management Portal->Interoperability->Configure->Production. There, we'll see the dc.Demo.RedditService business process running.

 Let's make a change to the dc.Demo.RedditService class definition and assign it a category. Then click Apply.

 
We go to VSCode and see that the business process class has already been uploaded to our file system and contains all the changes made.



 

Now all we have to do is place the classes in the appropriate directories and commit them to the repository.

Exporting BI Analytics classes.

Next, we'll look at another method for exporting files using business analytics elements as an example. Recall the data cube we created based on Reddit messages. Let's create a pivot and dashboard to visualize the data and try to export it. To do this, go to IRIS and navigate to Analytics->Analyzer. Here, we have the RedditMessages data cube selected and the basic Count measure.

Drag the measure into the Measures field and save the resulting pivot as Reddit Messages Amount.

 
Next, let's create a dashboard to display the resulting pivot. Go to Management Portal -> User Portal. In the window that opens, click the plus sign and select Add Dashboard.

 
Next, fill in the dashboard name and click OK.

 

Then add the previously created widget to the dashboard and click OK.

 

Done! Very simple. We've started developing analytics. Now we need to export these elements. Unfortunately, the current version of IRIS and Git-Source-Control doesn't allow you to track changes to analytics classes, but we have another convenient tool for this task.

We'll use iris-bi-utils. This is a set of utilities for exporting or importing any classes from IRIS to your file system. The main difference from Git-Source-Control is that the latter automatically tracks class changes, while iris-bi-utils exports classes manually. Using the iris-bi-utils application, you can download any classes and elements contained within IRIS.

So, let's start by installing iris-bi-utils in your IRIS.

Run the command in the console.

zpm "install iris-bi-utils"

 

We then run the command to set the project root directory to store objects.
​​

do ##class(BIInstruments.utils).workdir("/home/irisowner/dev/")

The following commands export the desired pivot and dashboard. Note the syntax of the exported class. The element name must be followed by its category and type: .pivot.DFI for the pivot and .dashboard.DFI for the dashboard.

do ##class(BIInstruments.export).export("Reddit Messages Amount.pivot.DFI")
do ##class(BIInstruments.export).export("Reddit overview.dashboard.DFI")

The files will be exported to the /dfi directory. This is where the bi analytics classes are stored.

We also place them in the appropriate directory and push the changes to the repository.

Exporting globals.

As a rule, we don't need to push global to the repository during development. Often, sensitive data is stored there, or the global size is too large. However, if necessary, they can always be exported to an external file system and committed to git using this method of %Library.Global class.

do ##class(%Library.Global).Export("NAMESPACE", "global.name, global.name1,....", “/path/and/outputFileName”)

      This can also be done through the Management Portal. To do this, go to Management Portal->System Explorer->Globals. Select the desired global and click Export. The interface has a convenient search function. Exporting is possible to the file system or to a browser.
 When exported, the global can be encoded using several variants of the most common


 
 

That's all, in this article we created a repository, looked at ways to exported business classes, analytics, and globals, and sent changes to the git repository.

Useful links for this article:

Discussão (0)1
Entre ou crie uma conta para continuar
Anúncio
· 4 hr atrás

Online Meetup with the Winners of the InterSystems "Bringing Ideas to Reality" Contest 2025

Hi Community,

Let's meet at the online meetup with the winners of the InterSystems "Bringing Ideas to Reality" Contest! It's a great opportunity to chat with the InterSystems experts team and our contestants.

Winners' demo included!

Date & Time: Thursday, December 18, 11:00 am EST | 5:00 pm CEST

Join us to learn more about winners' applications and to speak with our experts.

➡️ REGISTER TODAY

See you all at our virtual meetup! 

Discussão (0)1
Entre ou crie uma conta para continuar
Discussão
· 5 hr atrás

Code Golf: Binary encoding!

Time for another round of code golf!

Develop a function that performs a two-step encryption process on a given string:

  • First Step: Reverse Cipher

    • Reverse the entire input string.
    • Relocate the last character of the original string (now the first character of the reversed string) to the end.
  • Second Step: Alphabetic Index Binary Encoding

Discussão (0)1
Entre ou crie uma conta para continuar
Pergunta
· 8 hr atrás

Hi everyone , I finally found Santa's Mailbox - Hope all your wishes come true

 

Discussão (0)1
Entre ou crie uma conta para continuar
Pergunta
· 11 hr atrás

Default settings - Application priorities

Hello everyone.

I have a question regarding the priority when applying a default configuration.

I have several Business Services that use the same class, so I want them all to have a common "Schedule" configuration.

However, there's one that I don't want this default configuration applied to, so I've tried setting the Schedule value to empty for that element based on its name:

In this case, the elements that use the class Kurro.BS.SFTP.Marca have the default value "CargaFicheros".

However, one of the elements (Kurro.BS.SFTP.Special) should not have this configuration, so I have created an entry for this element.

The problem is that in production, the Kurro.BS.SFTP.Especial element appears with the host class's default configuration, instead of the one I specified for the element.

I also can't remove it directly from production because it tells me it's a Core setting and I can't modify it because it has a Default Setting property.

How can I set a specific configuration for an element that doesn't use the host class configuration?

Thank you so much

1 novo comentário
Discussão (1)1
Entre ou crie uma conta para continuar