Nova postagem

Pesquisar

Pergunta
· Abr. 4, 2024

How can I obtain the record of the last 2 hours of a table?

I need to obtain the records of the last  2 hours with format (HH:MM:SS), it only leaves me specifying the exact time

6 Comments
Discussão (6)3
Entre ou crie uma conta para continuar
Pergunta
· Abr. 4, 2024

How can I convert two timestamps into time format (HH:MM:SS)?

For example, I have two timestamp values ('2024-04-01 10:00:00', '2024-04-01 11:30:30'). I would like to find the difference between these two timestamps, and I need the result in hours:minutes:seconds (hh:mm:ss) format.

Expected Output: 01:30:30


Note: I need an SQL query command. I should not use ClassMethod, Function, or Stored Procedure.


Could anyone please provide me with an SQL query for my question?

4 Comments
Discussão (4)1
Entre ou crie uma conta para continuar
Artigo
· Abr. 3, 2024 2min de leitura

Comfortable VSCode Auto Save and ObjectScript CompileOnSave settings

Hi - Recently I have been investigating an annoying situation whilst editing ObjectScript classes or routines in VSCode.

What was happening to me was, as I was typing in lines of code into my class (for example, adding a new Method, or changing the Class signature, or a block of code),  this would quickly get syntax checked, re-formatted, and compiled - inevitably, (since I would be mid-way through my typing), this would generate compilation errors.

Knowing that I was mid-way through adding code, I could simply dismiss this message, however, this soon got very annoying, and conditioned me to ignore the error (which is not a good thing).

Even worse, however, is that the compilation process also reformatted the document and sometimes broke what was previously well formatted lines of code (appearing below the line I was writing) - which required me to go into that area of the document and fix them back up.

What's going on ?

There are two settings at play here:

  1. VSCode's auto-save (files.autosave) settings which dictates wether to automatically save a document that has been changed, and if so, how long to wait before saving (files.autoSaveDelay)
  2. ObjectScript extension's compileOnSave (objectscript.compileOnSave), which determines wether after saving the document, this also imports into and compiles on the connected IRIS namespace.

Since I had autosave turned on, and on a short wait delay together with compileOnSave meant that partially edited code kept compiling, generating the above erros, and as mentioned, sometimes re-formatting good, pre-existing blocks of code.

In my case, I have settled on the following:

  1. AutoSave (files.autosave) off (autosaveDelay is ignored),  and
  2. CompileOnSave (objectscript.compileOnSave) on.

Now, when I'm happy with my edits (in my own time !), I press Ctrl-S, to save, import and compile my class, and look out for that pop-up message which has real meaning and purpose now.

You may choose a different combination, (for example, go ahead and Autosave after 5 minutes or so, accepting the code may not fully compile), however, I've found the above combination works for me, and hope that - if you are experiencing the same annoyance, then, this article may help you find your optimum configuration.

Thankyou to @Patrick Sulin, and @Raj Singh for pointing me in the direction of these settings !

Steve Pisani

12 Comments
Discussão (12)8
Entre ou crie uma conta para continuar
Artigo
· Abr. 3, 2024 3min de leitura

Connect Microsoft Excel to InterSystems IRIS via ODBC (Windows)

How to create an ODBC connection on your native Windows laptop to IRIS running on a Windows VM on the same computer, test the connection, and pull data from IRIS into Excel.

Recently I learned that Excel can connect to external databases via ODBC. This includes basically any ODBC data source. Since IRIS speaks ODBC via the ODBC API, we can take advantage of the InterSystems ODBC Driver to establish an ODBC connection to IRIS on Windows that Excel can utilize.

Before getting started, make sure you have installed the latest InterSystems ODBC driver on your native Windows, which can either be found on WRC or on GitHub. I assume that you are running IRIS on a Windows VM using VMWare hosted on your Windows machine. I also assume that you have Microsoft Excel installed on your native Windows as well. You’ll also need some data pre-loaded into your namespace to access. For this post, I am using data from the Python Quickstart. The data can be found on GitHub.

First you need to find the IP address for the VM. (Keep in mind that you may need to repeat this step if you restart the VM, connect to a different network or connect/disconnect a VPN connection.)

To find your IP address in the Windows VM, go to the Windows Command Prompt (cmd):

  1. In the VM, hold the Windows key and the R key. This opens the Run dialog (as seen below). Type in “cmd” and click <OK>:

 

  1. On the Command Prompt, type in “ipconfig -all” to find your IP address. You want to locate the line that says “IPv4 Address….” And make note of the numeric IP address given on that line:

 

  1. Also make note of the Web Server Port of your VM IRIS, because you’ll need that later.

 

Now, return to the Windows host system and open the ODBC Data Source Administrator (ODBC DSA) and configure the connection:

  1. In the ODBC DSA, open the “System DSN” tab and click “Add”:

 

  1. You will be prompted to select a driver for the data source. If you installed the InterSystems ODBC driver on your native Windows machine, you should select “InterSystems IRIS ODBC…” as I have done below and click “Finish”:

 

 

 

  1. This will open a new dialog where you need to name the data source, provide a description, input the IP address you copied previously and the Web Server Port. Input the namespace you want to connect to, the User Name and Password that you use for the Management Portal as well. Then click <Test Connection> as shown below:

 

 

  1. If all went well, you should see that the test completed successfully as shown below. This means that we now have a connection via our native Windows to IRIS on the VM:

 

Now we can open Microsoft Excel and access data via the ODBC data source. We do this by selecting the “Data” tab (1), then clicking “Get Data” (2). Click “From Other Sources” (3), and then “From ODBC” (4).

 

 

From the drop down, select the data source you created previously and click OK:

 

In the Navigator, select the table you want to connect to and click “Load”:

 

From here, we can see that we successfully connected to the data on IRIS on a VM and are able to access it in Microsoft Excel running on native Windows:

 

Wrapping up, we might wonder why we would want to access IRIS data in Excel. Many people have years of Excel expertise. They can use Excel to explore data, create pivot tables, visualizations, and dashboards.

2 Comments
Discussão (2)2
Entre ou crie uma conta para continuar
Artigo
· Abr. 3, 2024 2min de leitura

Reviews on Open Exchange - #41

If one of your packages on OEX receives a review you get notified by OEX only of YOUR own package.   
The rating reflects the experience of the reviewer with the status found at the time of review.   
It is kind of a snapshot and might have changed meanwhile.   
Reviews by other members of the community are marked by * in the last column.

I also placed a bunch of Pull Requests on GitHub when I found a problem I could fix.    
Some were accepted and merged, and some were just ignored.     
So if you made a major change and expect a changed review just let me know.

# Package Review Stars IPM Docker *
1 iris-xml-sample just perfect 5.5* 5.5   y  
2 fhirserver-profile-based-validation A valuable help to save time on the operation of FHIR profile validation. 5.0     *
3 Jupyter Server Proxy for VS Code Great utility 5.0   y *
4 OwnObjectScriptExtension Works 5.0     *
5 Vector-inside-IRIS all in COS 5.0 y y *
6 webHERALD Simplifying Mobile Integration for Caché Developers 5.0     *
7 workshop-smart A valuable help to save time on the operation of FHIR profile validation. 5.0   y *
8 UnitTest_RuleSet Great working example - easy to adapt 5.0     *
9 workshop-vector-face funny example on vectors 4.8   y  
10 yaml-utils Excellent yaml to json converter. 4.6 y   *

 

A Bit of History & Statistics

  • I started this series 3 years ago with April 2021 reviews
  • 913 packages of OEX were checked over this time
  • 708 (77.3 %) had a review worth to be listed
  • 576 (81.4 %) of them were done by myself
  • 134 (18.6 %) were contributed by other members of the community (BIG THANKS)

A technical note

All data were collected by analysis of official published web pages of OEX and GitHub.
So there may be some numeric differences as I never adjusted historical data.

Discussão (0)1
Entre ou crie uma conta para continuar