0 Followers · 1.1K Posts

SQL is a standard language for storing, manipulating and retrieving data in relational databases.

Question Scott Roth · Dec 6, 2024

First time trying to use Foreign Tables/Servers instead of Linked Tables...

Within the SQL Editor inside of the Managment Portal, or connecting through DBeaver JDBC how we can see what Foreign Servers have been defined? Is there a way to query and verify structure of the Foreign Server connection to know that we are building the correct Foreign Tables?

I attempted to create my first Foreign table but it failed when I tried to query the tables because it said the table could not be found. But when I sign into the Database via SQL Management Studio, I can see the table.

0
0 0
Question Steven Henry Suhendra · Dec 2, 2024

Hello My Friends,

I have a question how to use order by %DLIST, this is my code:

SELECT

$ListToString(%DLIST(DISTINCT MRDIA_ICDCode_DR->MRCID_Code),', ' ) ICDX,

$ListToString(%DLIST(DISTINCT (MRDIA_ICDCode_DR->MRCID_Desc || ' (' || MRDIA_DiagnosisType_DR->DTYP_Code || ')')),', ' ) Diagnose

FROM SQLUser.PA_Adm

LEFT JOIN SQLUser.PA_AdmInsurance ON (PAADM_RowID = INS_ParRef AND INS_Rank = 1)

LEFT JOIN SQLUser.PA_AdmPackage ON (PAADM_RowID = PACK_ParRef)

LEFT JOIN SQLUser.MR_Adm on MRADM_ADM_DR = PAADM_RowID

LEFT JOIN SQLUser.MR_Diagnos ON MRADM_RowId = MRDIA_MRADM_ParRef

0
0 0
Question Patrik Spisak · Nov 28, 2024

I have issue with one of my queries. That query work fine for ages, but suddenly stop works and giving me SQLCODE 100 in the routine. 

&SQL(SELECT * FROM (
		SELECTeventFROM dhr_log_lasers.production WHERE createDateUTC >= DATEADD(dd, -5, CURRENT_DATE) AND kiosk = :%var("kioskID") GROUP BY machine
		HAVING ID = MAX(ID)
	  ) WHERE event != 2
	 )

If I copy this same query to the management portal and replace variable with real ID I will get back 6 or more rows.

0
0 0
Article Yuri Marx · Nov 27, 2024 8m read

The rise of Big Data projects, real-time self-service analytics, online query services, and social networks, among others, have enabled scenarios for massive and high-performance data queries. In response to this challenge, MPP (massively parallel processing database) technology was created, and it quickly established itself. Among the open-source MPP options, Presto (https://prestodb.io/) is the best-known option. It originated in Facebook and was utilized for data analytics, but later became open-sourced. However, since Teradata has joined the Presto community, it offers support now.

0
0 0
Question Dmitrij Vladimirov · Nov 22, 2024

Hence the question: is there a way to do that?
The goal is to get data (from half a thousand to 3-4 thousands lines) from DB, calculate standart deviation  then use it as logical condition in analyzer. 
For example IF std > custom_value = show_the_result ELSE null
There is a STDDEV(MDX) method  used in Analyzer but it is a measure and it can not be used as logical condition (correct me if i am wrong)

0
0 0
Article Sylvain Guilbaud · Apr 30, 2024 3m read

Production Configuration

This demo has an interoperability production with 16 items. 

Production Configuration HL7 + Kafka Producer

The first part of this demonstration consists of sending an HL7 SIU file which will be transmitted to the 2 other HL7 flows (HTTP and TCP), and transformed and transmitted to the Kafka server. HTTP and TCP flows will transform HL7 messages in the same way before sending them to Kafka as well.

  • 3 HL7 Business Services
  • 1 HL7 router
  • 2 HL7 Business Operations
  • one Business Operation sending the transformed messages to Kafka

Business Rule

0
0 411
Question Scott Roth · Nov 20, 2024

I am using a JDBC connection to MS SQL server to execute a stored procedure to select data and bring it into InterSystems as a EnsLib.SQL.Snapshot. I loop through the EnsLib.SQL.Snapshot using a while loop, but I also want to iterate through the Columns within that Row to do logic.

Is there a way to iterate through the Columns of the current Row of the EnsLib.SQL.Snapshot so I can apply logic/rules for further processing?

Thanks

Scott

0
0 0
Question David.Satorres6134 · Nov 13, 2024

Hello all,

We have our system with AutoParallel enabled:

USER>w ##class(%SYSTEM.SQL.Util).GetOption("AutoParallel")
1

But whenever I try to run any sql the autoparallel does not work. For example, this simple query:

When I force it with %PARALLEL we can see it will effectively run in parallel:

The total records is bigger than the threshold. So, what can go wrong? Anyone in the same situation?

0
0 0
Question Dmitrii Baranov · Nov 17, 2024

I'm playing with some anayltic queries against FHIR server tables. The HSFHIR_X0002_S_Patient.addressCity table contains a lot of cities which names contain german charachers such as ä, ö and ü.

The following query works fine:

select value from HSFHIR_X0002_S_Patient.addressCity

But this one converts city names to uppercase, and characters with umlauts are lost, so instead of "Köln" or "München" I see KOLN and MUNCHEN:

select ac.value, count(ac.value) as cnt
  from HSFHIR_X0002_S_Patient.addressCity ac
  group by ac.value
  order by 2 desc

I'm using DBeaver with IRIS official JDBC driver.

0
0 0
Question Richard Prouvot · Nov 13, 2024

I HAVE A NEW SQL CLASS THAT DISPLAYS ENTRIES BASED ON THE FIRST 2 NODES OF A GLOBAL. I FOUND OUT THAT THE CLASS ALLOWS FOR AN ADDITIONAL NODE(s) TO BE INSERTED IN THE "User Specification Node:" along the delimiter and the Piece in the NewStorage Map1 for "ModifyDDDD" shown below. it is not working.

^GBL("AA","SSSSSS")="1:1:1:1:"

^GBL("AA,"MD",1,1)="1:"

^GBL("AA,"MD","A",1)="0:"

I HAVE USED THIS:

<Data name="ModifyDDDD">
<Delimiter>":"</Delimiter>
<Node>"3,4"</Node>
<Piece>1</Piece>
</Data>

WHILE IT COMPILES IT DISPLAY NOTHING. MY QUESTION IS WHAT IS THE RIGHT SYNTAX AND PUNTUATION FOR THIS, PLEASE?

0
0 0
Article Megumi Kakechi · Nov 14, 2024 1m read

InterSystems FAQ rubric

By default, the order of columns in a table is determined automatically by the system. To change the order, explicitly set the order for each property using the property keyword SqlColumnNumber when defining the class.

Example:

Property Name As %String [SqlColumnNumber = 2];

Please see the documentation below.

SqlColumnNumber

If you want to change the SQL table name, specify SqlTableName. If you want to change the column name (field name), specify SqlFieldName.

Both apply only to persistent classes.

0
0 0
Question Andreas Schneider · Sep 15, 2024

Has anyone successfully tested the new THROUGH command in IRIS 2024.2 with a FOREIGN SERVER?https://docs.intersystems.com/iris20242/csp/docbook/Doc.View.cls?KEY=RS…

I have connected from a Docker instance to a VM. I was able to successfully set up the JDBC connection through the UI.

I then configured a foreign server with this connection:

But I am unable to send a SQL 'THROUGH' to the DB. I always get a:

I've get the same message if i try it via Management Portal.
I've also tried this:

and this

0
0 0
Article Guillaume Rongier · Jul 8, 2024 6m read

Description

This is a template for a FastApi application that can be deployed in IRIS as an native Web Application.

Installation

  1. Clone the repository
  2. Create a virtual environment
  3. Install the requirements
  4. Run the docker-compose file
git clone
cd iris-fastapi-template
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
docker-compose up

Usage

The base URL is http://localhost:53795/fastapi/.

Endpoints

0
0 0
Article Timothy Leavitt · Oct 28, 2024 2m read

User-defined aggregate functions have been supported in IRIS since 2021.1.0. I'd wished upon a star for these years ago before finding a secret hacky way to override MAX and MIN in a custom datatype, but didn't get a chance to actually try one out until today. I thought it was an interesting experience/example - the question of how to get a Median in IRIS SQL came up once before - so I'm sharing it here without too much further comment.

0
0 0
Discussion Otto Medin · Oct 19, 2024

In the past, I've created custom SQL operations, but now I had something trivial to do, so I decided to take EnsLib.SQL.Operation.GenericOperation out for a spin. There's no example in the docs, so it was a little tricky. Here's what I ended up doing:

In my external database, I have 'mytable' with two fields 'id1' and 'id2'. Here are the pertinent Business Operation settings:

SQL: select id2 from mytable where id1 = ?
Input Parameters: [1] *id1
RequestClass: Ens.StringRequest
ResponseClass: MyResponseClass

0
0 0
Question Kurro Lopez · Oct 18, 2024

Hi all,

We have an restriction in a SQL database with a unique index.

We want to catch that exception when it tries to insert or update a value that violates the unique index condition.

// run the querySet tSC = ..Adapter.ExecuteUpdateParmArray(.nrows,SQL,.param)

// Check if there is any errorIf$$$ISERR(tSC)
{
	Set msgError = $System.Status.GetErrorText(tSC) 
	// Check here if the native error code is 2601 (Cannot insert duplicate key row into object 'MYPATIENTS' with unique index 'UQ_UNIQUE_INDEX')
	??????
}

I've tried to get the ..Adapter.%SQLCODE, but it is empty

0
0 0
Question Qais Azam · Oct 16, 2024

I am experiencing an issue while executing a stored procedure in InterSystems Cache. Here’s the procedure I createdCREATE PROCEDURE Silk.sp_InsertRecord (    IN RecordDate TIMESTAMP,    IN UserName VARCHAR(50),    IN RecordType INT,    IN RecordID VARCHAR(50),    IN CategoryID INT,    IN ApprovalDate TIMESTAMP,    IN FileSize BIGINT,    IN WorkstationName VARCHAR(50))BEGIN     INSERT INTO DummyRecords (        RecordKey,         FilePath,         RecordDate,         UserName,         RecordType,         RecordID,         CategoryID,         FileSize    )     VALUES (       

0
0 0
Article Robert Cemper · Mar 21, 2024 2m read

In ObjectScript you have a wide collection of functions that return some value
typically:

set variable = $somefunction(param1,param2, ...)

There is nothing special about that.
But there is a set of functions that I classify as LEFT SIDED 
The specialty of them is that you can use them also on the left of the equal operator 
as a target in the SET command:

set $somefunction(param1,param2, ...) = value

The reason to raise that subject is that with IRIS 2024.1 there is after may years  a "new kid on this block"

$VECTOR()

0
0 279
Question Christine Nyamu · Oct 9, 2024

Hello all,

I need help with coming up with a SQL query that pulls only one value. I have a case where two providers share the exact same name. Each has a different NPI number and IdentityTypeId. I tried the below query - output is also below. 

SELECT *                        
FROM PhysTable                        
WHERE ProviderName = 'DOE, JOE' AND Type = 'NPI'                        
                        
UNION                        
                        
SELECT *                        
FROM PhysTable                        
WHERE IdentityId = '345678'                        
 

Output

0
0 0
Question Scott Roth · Oct 2, 2024

I have been trying to track down an issue we are seeing in our TEST environment with Memory usage.

We have Several BP's for years now that take a HL7 message, parse it apart, and make calls to a Custom EnsLib.SQL.OutboundAdapter to have it execute Insert/Select/Update/Delete stored procedures against a MS SQL Database via JDBC connection. We are using Microsoft's JDBC 12.2 driver to do this.

What we are seeing is that IRIS.WorkQueue globals are being defined for these calls but then the IRIS.WorkQueue is not being cleaned up and taking up large amounts of Memory.

0
0 0
Article Muhammad Waseem · Sep 23, 2024 4m read

Hi Community,
In this article, I will introduce my application iris-DataViz
iris-DataViz is an Exploratory Data Analysis and Visualization Streamlit Application that leverages the functionality of IRIS embedded python and SQLAlchemy to interact with IRIS, as well as the PyGWalker python library for data analysis and data Visualization. PyGWalker (Python Graphic Walker) is an interactive data visualization library built for Python, aiming to bring the ease and functionality of Tableau-style drag-and-drop visualization into Python environments.


Application Features 

0
0 0
Article Andrii Mishchenko · Sep 27, 2024 4m read

In this article, we’ll dive into the inner workings of the database management tool, exploring the architecture and technologies that power it. Understanding how the application functions behind the scenes will give you insight into its design, how it manages databases, tables, and how the API interacts with data.

We will discuss the core technologies used, including InterSystems IRIS as the primary database and Redis for caching. Additionally, we’ll break down the structure of the tables used and explain how the system handles data creation, retrieval, and manipulation through the REST API.

0
0 0
Article Murray Oldfield · Sep 24, 2024 7m read

Problems with Strings

I am accessing IRIS databases with JDBC (or ODBC) using Python. I want to fetch the data into a pandas dataframe to manipulate the data and create charts from it. I ran into a problem with string handling while using JDBC. This post is to help if anyone else has the same issues. Or, if there is an easier way to solve this, let me know in the comments!

I am using OSX, so I am unsure how unique my problem is. I am using Jupyter Notebooks, although the code would generally be the same if you used any other Python program or framework.

The JDBC problem

0
0 0