New
Question Tom Scaletti · 16 hr ago

I am working on a cache database query. Since the cache database doesn't support CTE I am using joins to calculate data. The issue is that aggregated data is only calculated for one where the condition for each row in the union. For eg. only the 'Prop decisioned' row is calculated others are always 0. There are many more case conditions.

 

SELECT
    PT.TYPE_ID, 
    CASE WHEN PT.TYPE_ID ='' THEN '' ELSE  COALESCE(main.PROP_CT, 0) END AS PROP_CT,  
    CASE WHEN PT.TYPE_ID ='' THEN '' ELSE  COALESCE(main.BEG_BAL_AMT, 0) END AS BEG_BAL_AMT,   
    CASE WHEN PT.TYPE_ID ='' THEN '' ELSE  COALESCE(main.BEG_BAL_PCT, 0) END AS BEG_BAL_PCT, 
    CASE WHEN PT.TYPE_ID ='' THEN '' ELSE  COALESCE(main.AECB_PROP_CT, 0) END AS AECB_PROP_CT,  
    CASE WHEN PT.TYPE_ID ='' THEN '' ELSE  COALESCE(main.AECB_BEG_BAL_AMT, 0) END AS AECB_BEG_BAL_AMT,
    CASE WHEN PT.TYPE_ID ='' THEN '' ELSE  COALESCE(main.FSB_PROP_CT, 0) END AS FSB_PROP_CT, 
    CASE WHEN PT.TYPE_ID ='' THEN '' ELSE  COALESCE(main.FCB_BEG_BAL_AMT, 0) END AS FCB_BEG_BAL_AMT
FROM
(    
SELECT 'NOT WORKED and DP Rejects:'  AS TYPE_ID
UNION ALL
SELECT ''
UNION ALL
SELECT 'REJECTS - AGENCY OR PROP ISSUE'
UNION ALL
SELECT 'PROPS DECISIONED'
UNION ALL
SELECT '* ZZ (NO EXP CODE)'
UNION ALL
SELECT 'DECLINED PROPS'
UNION ALL
SELECT 'ACCEPTED PROPS'
)AS PT
LEFT JOIN
(
SELECT
        CASE
        WHEN rawData.ZZCCACCREJ IN ('R','A') THEN 'PROPS DECISIONED'
        WHEN rawData.ZZCCACCREJ = 'R' THEN 'DECLINED PROPS'
        WHEN rawData.ZZCCACCREJ = 'A' THEN 'ACCEPTED PROPS'
        WHEN rawData.ZZCCACCREJ = 'R' AND rawData.ZZCCEXPCODE = 'DP' THEN 'NOT WORKED and DP Rejects:'
        WHEN rawData.ZZCCACCREJ = 'R' AND rawData.ZZCCEXPCODE IN ('UA','PI','ZB') THEN 'REJECTS - AGENCY OR PROP ISSUE'
        WHEN rawData.ZZCCACCREJ = 'R' AND TRIM(ISNULL(rawData.ZZCCEXPCODE,'')) = '' THEN '* ZZ (NO EXP CODE)'
        END AS TYPE_ID
        ,COUNT(DISTINCT rawData.ZZPACCTID) as PROP_CT
        ,ISNULL(SUM(COALESCE(rawData.ZZAMRTAMEXBEGBAL,rawData.ZZPTOTALBA,rawData.ZZRPPSACCTBAL)),0) AS BEG_BAL_AMT
        ,ROUND(ISNULL(SUM(COALESCE(rawData.ZZAMRTAMEXBEGBAL,rawData.ZZPTOTALBA,rawData.ZZRPPSACCTBAL)) * 100 / NULLIF(totalData.BEG_BAL_AMT,0),0),2) AS BEG_BAL_PCT
        ,SUM(CASE WHEN rawData.ZZFS9FICOSCORE > 0 THEN 1 ELSE 0 END) AS AECB_PROP_CT
        ,ROUND(SUM(CASE WHEN rawData.ZZFS9FICOSCORE > 0 THEN 1 ELSE 0 END) * 100 / NULLIF(totalData.AECB_PROP_CT,0),2)  AS AECB_Prop_PCT
        ,SUM(CASE WHEN rawData.ZZFS9FICOSCORE > 0 THEN  COALESCE(rawData.ZZAMRTAMEXBEGBAL,rawData.ZZPTOTALBA,rawData.ZZRPPSACCTBAL) ELSE 0 END) AS AECB_BEG_BAL_AMT
        ,ROUND(SUM(CASE WHEN rawData.ZZFS9FICOSCORE > 0 THEN  COALESCE(rawData.ZZAMRTAMEXBEGBAL,rawData.ZZPTOTALBA,rawData.ZZRPPSACCTBAL) ELSE 0 END) * 100 
            / NULLIF(totalData.AECB_BEG_BAL_AMT,0),2) AS AECB_BEG_BAL_PCT
        ,SUM(CASE WHEN rawData.ZZFS9FSBIND > 0 THEN 1 ELSE 0 END) AS FSB_PROP_CT
    ,SUM(CASE WHEN rawData.ZZFS9FSBIND > 0 THEN  COALESCE(rawData.ZZAMRTAMEXBEGBAL,rawData.ZZPTOTALBA,rawData.ZZRPPSACCTBAL) ELSE 0 END) AS FCB_BEG_BAL_AMT
FROM (
    SELECT 
        proposal.ZZPACCTID,
        NULLIF(SUM(amortization.ZZAMRTAMEXBEGBAL), 0) AS ZZAMRTAMEXBEGBAL,
        MAX(proposal.ZZPRECVD) AS proposalDate,
       NULLIF(SUM(proposal.ZZPTOTALBA),0) as ZZPTOTALBA
    ,NULLIF(SUM(rppsInfo.ZZRPPSACCTBAL),0) as ZZRPPSACCTBAL
    ,ISNULL(SUM(CASE WHEN zzfiscal9.ZZFS9FICOSCORE IS NULL OR TRIM(zzfiscal9.ZZFS9FICOSCORE) = '' THEN 0 ELSE 1 END),0) as ZZFS9FICOSCORE
    ,ISNULL(SUM(CASE WHEN zzfiscal9.ZZFS9FSBIND IS NULL OR TRIM(zzfiscal9.ZZFS9FSBIND) = '' THEN 0 ELSE 1 END),0) as ZZFS9FSBIND
        ,cdmpinfo.ZZCCEXPCODE,cdmpinfo.ZZCCACCREJ,cdmpinfo.ZZCCSUBCODE
    FROM SQLUser.ARACCOUNT account
    INNER JOIN SQLUser.ARRELATIONSHIP ARREL ON ARREL.ARRELACID = account.ARACID
    INNER JOIN SQLUser.ARENTITY ARENTITY ON ARENTITY.ARENID = account.ARACID
    INNER JOIN SQLUser.ZZRPPSINFO rppsInfo ON account.ARACID = rppsInfo.ZZRPPSACCTID
    INNER JOIN SQLUser.ZZPROPOSAL proposal ON proposal.ZZPACCTID = rppsInfo.ZZRPPSACCTID
    LEFT  JOIN SQLUser.ZZCDMPINFO cdmpinfo ON account.ARACID = cdmpinfo.ZZCCACCTID
    LEFT JOIN SQLUser.ZZAMORTIZATION amortization ON amortization.ZZAMRTACCTID = account.ARACCLTID
    LEFT JOIN SQLUser.ZZFISCAL9 zzfiscal9 ON zzfiscal9.ZZFS9ACCTID = account.ARACID 
    --WHERE rppsInfo.ZZRPPSRECVD BETWEEN DATEADD(DAY, LAST_DAY(DATEADD(MONTH, -24, GETDATE())), 1) AND LAST_DAY(DATEADD(MONTH, -1, GETDATE()))
        --AND cdmpinfo.ZZCCACCREJ = 'R'
    GROUP BY proposal.ZZPACCTID,cdmpinfo.ZZCCACCREJ, cdmpinfo.ZZCCEXPCODE,cdmpinfo.ZZCCSUBCODE
) AS rawData
LEFT JOIN (
    SELECT TOP 1
        COUNT(DISTINCT ZZPACCTID) as PROP_CT
    ,SUM(COALESCE(ZZAMRTAMEXBEGBAL,ZZPTOTALBA,ZZRPPSACCTBAL)) AS BEG_BAL_AMT
    ,SUM(CASE WHEN ZZFS9FICOSCORE > 0 THEN 1 ELSE 0 END) AS AECB_PROP_CT
    ,SUM(CASE WHEN ZZFS9FICOSCORE > 0 THEN  COALESCE(ZZAMRTAMEXBEGBAL,ZZPTOTALBA,ZZRPPSACCTBAL) ELSE 0 END) AS AECB_BEG_BAL_AMT
    ,SUM(CASE WHEN ZZFS9FSBIND > 0 THEN 1 ELSE 0 END) AS FSB_PROP_CT
    ,SUM(CASE WHEN ZZFS9FSBIND > 0 THEN  COALESCE(ZZAMRTAMEXBEGBAL,ZZPTOTALBA,ZZRPPSACCTBAL) ELSE 0 END) AS FCB_BEG_BAL_AMT
    FROM (
        SELECT %NOLOCK DISTINCT
            proposal.ZZPACCTID as ZZPACCTID
            ,MAX(proposal.ZZPRECVD) as proposalDate
            ,NULLIF(SUM(amortization.ZZAMRTAMEXBEGBAL),0) as ZZAMRTAMEXBEGBAL
            ,NULLIF(SUM(proposal.ZZPTOTALBA),0) as ZZPTOTALBA
            ,NULLIF(SUM(rppsInfo.ZZRPPSACCTBAL),0) as ZZRPPSACCTBAL
            ,ISNULL(SUM(CASE WHEN zzfiscal9.ZZFS9FICOSCORE IS NULL OR TRIM(zzfiscal9.ZZFS9FICOSCORE) = '' THEN 0 ELSE 1 END),0) as ZZFS9FICOSCORE
            ,ISNULL(SUM(CASE WHEN zzfiscal9.ZZFS9FSBIND IS NULL OR TRIM(zzfiscal9.ZZFS9FSBIND) = '' THEN 0 ELSE 1 END),0) as ZZFS9FSBIND
        FROM SQLUser.ARACCOUNT account
        INNER JOIN SQLUser.ARRELATIONSHIP ARREL ON ARREL.ARRELACID = account.ARACID
        INNER JOIN SQLUser.ARENTITY ARENTITY ON ARENTITY.ARENID = account.ARACID
        INNER JOIN SQLUser.ZZRPPSINFO rppsInfo ON account.ARACID = rppsInfo.ZZRPPSACCTID
        INNER JOIN SQLUser.ZZPROPOSAL proposal ON proposal.ZZPACCTID = rppsInfo.ZZRPPSACCTID
        LEFT  JOIN SQLUser.ZZCDMPINFO cdmpinfo ON account.ARACID = cdmpinfo.ZZCCACCTID
        LEFT JOIN SQLUser.ZZAMORTIZATION amortization ON amortization.ZZAMRTACCTID = account.ARACCLTID
        LEFT JOIN SQLUser.ZZFISCAL9 zzfiscal9 ON zzfiscal9.ZZFS9ACCTID = account.ARACID
        --WHERE rppsInfo.ZZRPPSRECVD BETWEEN DATEADD(DAY, LAST_DAY(DATEADD(MONTH, -12, GETDATE())), 1) AND LAST_DAY(DATEADD(MONTH, -1, GETDATE()))
        GROUP BY proposal.ZZPACCTID
    ) AS totalData
) AS totalData ON 1=1
WHERE 
        CASE
        WHEN rawData.ZZCCACCREJ IN ('R','A') THEN 'PROPS DECISIONED'
        WHEN rawData.ZZCCACCREJ = 'R' THEN 'DECLINED PROPS'
        WHEN rawData.ZZCCACCREJ = 'A' THEN 'ACCEPTED PROPS'
        WHEN rawData.ZZCCACCREJ = 'R' AND rawData.ZZCCEXPCODE = 'DP' THEN 'NOT WORKED and DP Rejects:'
        WHEN rawData.ZZCCACCREJ = 'R' AND rawData.ZZCCEXPCODE IN ('UA','PI','ZB') THEN 'REJECTS - AGENCY OR PROP ISSUE'
        WHEN rawData.ZZCCACCREJ = 'R' AND TRIM(ISNULL(rawData.ZZCCEXPCODE,'')) = '' THEN '* ZZ (NO EXP CODE)'
        END  IS NOT NULL
GROUP BY  --23018931.86
    CASE
        WHEN rawData.ZZCCACCREJ IN ('R','A') THEN 'PROPS DECISIONED'
        WHEN rawData.ZZCCACCREJ = 'R' THEN 'DECLINED PROPS'
        WHEN rawData.ZZCCACCREJ = 'A' THEN 'ACCEPTED PROPS'
        WHEN rawData.ZZCCACCREJ = 'R' AND rawData.ZZCCEXPCODE = 'DP' THEN 'NOT WORKED and DP Rejects:'
        WHEN rawData.ZZCCACCREJ = 'R' AND rawData.ZZCCEXPCODE IN ('UA','PI','ZB') THEN 'REJECTS - AGENCY OR PROP ISSUE'
        WHEN rawData.ZZCCACCREJ = 'R' AND TRIM(ISNULL(rawData.ZZCCEXPCODE,'')) = '' THEN '* ZZ (NO EXP CODE)'
    END
) AS main on pt.type_id= main.type_id 
0
0 14
InterSystems Developer Community is a community of 27,024 amazing developers
We're a place where InterSystems IRIS programmers learn and share, stay up-to-date, grow together and have fun!
New
Article Robert Cemper · May 22 1m read

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.

1
0 34
New
Question Scott Roth · May 22

Over the years, we keep monitoring Orphan Messages, and I have begun to notice the number of ACK/NCK's that do not match the Scheme in which the message was sent so it can't not align or signify that the message was OK. For example, if we send an ADT^A08 HL7 message to the vendor, and they send back a A08 instead of an ACK as the message type.

Currently our default is to have Save Replies on EnsLib.HL7.Operation set to IndexNotOk's.

1
0 16
New
InterSystems Official Bob Kuszewski · May 21

InterSystems is pleased to announce the general availability of:

  • InterSystems IRIS Data Platform 2026.1.0.237.3
  • InterSystems IRIS for Health 2026.1.0.237.3
  • HealthShare Health Connect 2026.1.0.237.3

This release adds support for the Ubuntu 26.04 operating system.  Ubuntu 26.04 includes Linux kernel 7.0, security improvements, along with installer and user interface improvements.  

We are only releasing IRIS for Intel/AMD (x86_64) processors at this time.  We've seen occasional network problems on ARM servers.

0
0 37
New
Announcement Celeste Canzano · May 21

Hello everyone,

The InterSystems Learning Services Certification Team is pleased to announce the release of our second TrakCare / IntelliCare certification exam - the InterSystems EHR Integration Specialist exam. A big thank you to everyone in the community who helped us beta test!

The exam is now available for purchase and scheduling in the InterSystems exam catalog. Potential candidates can review the exam topics and the practice questions on the exam's homepage.

1
0 25
New
Question RKumar · May 21
Currently, my Caché code triggers an email using Basic Authentication. Now Microsoft is going to stop Basic SMTP Authentication. In this case, what is the best approach to trigger an email alert from the database? It seems OAuth 2.0 is the best approach. Do anybody have any sample using Azure Entra ID?
2
1 30
New
Announcement Ali Nasser · May 21

Hello everyone,

The InterSystems Learning Services Certification Team is pleased to announce the release of the InterSystems CCR EHR Application Specialist exam. The exam is now available for purchase and scheduling in the InterSystems exam catalog.

This certification is intended for InterSystems EHR application specialists who use Tier 2 CCRs to manage and deploy configuration changes across environments. The content covers CCR fundamentals through Tier 2–specific topics.

2
0 26
New
Discussion Ethan Calloway · May 20

 I’m exploring deployment options for InterSystems IRIS in cloud environments such as AWS or Azure.

What deployment architectures, scaling strategies, or infrastructure best practices are commonly recommended by the community? I’d also appreciate guidance regarding high availability, backups, and monitoring in cloud-based deployments.

2
0 48
New
Discussion Ethan Calloway · May 20

 What logging and auditing strategies are commonly recommended for InterSystems IRIS environments?

I’m interested in learning about best practices for tracking user activity, troubleshooting issues, monitoring integrations, and maintaining compliance in enterprise or healthcare systems.

Are there built-in tools or external integrations that work especially well for this purpose?

1
0 36
New
Announcement Anastasia Dyubaylo · May 18

Hi Community!

It's time to celebrate our 18 fellow members who took part in the latest InterSystems Technical Article Contest and wrote

🌟 21 AMAZING ARTICLES 🌟

The competition brought together outstanding publications, each showcasing expertise and innovation. With so many high-quality submissions, selecting the best was a true challenge for the judges.

Let's meet the winners and look at their articles:

4
0 173
New
Question Ethan Calloway · May 20

 I’m looking for recommendations to improve interoperability performance in InterSystems IRIS, especially when handling large volumes of HL7 or healthcare-related messages.

What are the best practices for optimizing productions, business services, operations, and message processing performance? I’d also like to know if there are recommended monitoring tools or settings commonly used in production environments.

1
0 28
New
Discussion Ethan Calloway · May 20

 I’m currently working with REST APIs in InterSystems IRIS and would like to better understand the recommended security practices for production environments.

I’m especially interested in:

  • Authentication and authorization methods
  • Token management strategies
  • Role-based access control
  • API gateway recommendations
  • Encryption and secure communication practices
  • Monitoring and logging for API activity

I would also appreciate learning about common mistakes to avoid when deploying APIs publicly or integrating with external systems.

What approaches or tools have worked best in your environments?

1
0 36
New
Question Paul Coviello · May 20

I'm running a shell script and the q isn't exiting the screen. this is RHEL 7.9  I used to issue in VMS just fine but we have found that Linux scripts behave different.  after these run I search the file for the status and depending on what it comes back with it will send an email.

if someone has anything better I'm listening 

thanks

Paul

#!/bin/bash
TO_DAY=$(date +%A)
echo "Today is $TO_DAY"
#
touch /temp/CHECK_MIRROR_RPT.TXT
#
exec > /temp/CHECK_MIRROR_RPT.TXT
#
cache -U "%SYS" "Monitor^MIRROR"
q
#

2
0 24
New
Question Ethan Calloway · May 20

 I’m looking for practical recommendations to monitor InterSystems IRIS performance in a production environment. What are the most useful built-in tools, metrics, or best practices to track system health, database performance, and possible bottlenecks?

I would also like to know if there are recommended dashboards, logs, or monitoring integrations commonly used by the community.

1
0 35
New
Article José Pereira · May 19 13m read

Abstract

Common Table Expressions (CTEs) provide a structured framework for defining reusable intermediate result sets within SQL statements. InterSystems IRIS implements CTEs via the WITH clause, enabling clearer query composition and modular analytical processing while remaining fully integrated with the IRIS cost-based optimizer.

This article explores the semantics of CTEs in InterSystems IRIS, explains their interaction with query optimization, discusses appropriate deployment scenarios, and presents executable examples illustrating practical patterns for production environments.


0
0 46
New
Question Luis Gallardo · May 18

What is the recommended approach for handling upgrades in an InterSystems IRIS Kubernetes environment?

For example, if we deploy version 1.0.0 of our product and subsequently need to upgrade to 1.0.1, and this upgrade requires changes to SQL tables containing customer data.

The quickest solution that comes to mind is creating an 'upgrade method' that runs on startup to check if any data migration actions are required. However, I'm wondering if there are better solutions or established best practices for this.

Thanks in advance!

1
0 30
New
Article Guillaume Rongier · May 18 8m read

 

When developing Python applications with InterSystems IRIS, you can quickly end up with several execution contexts:

  • Python launched directly by IRIS with Embedded Python;
  • a regular python3 process that loads the Embedded Python libraries from a local IRIS installation;
  • an external Python application that connects to IRIS through the official native driver.

These three cases are useful, but they do not behave exactly the same way for imports, system configuration, object APIs, and SQL access.

0
2 38
New
Article Yuri Marx · May 17 2m read

Redoc is an Open Source solution capable of rendering API specifications in OpenAPI 2.0 or 3.0+ as very beautiful and functional web portals. Currently, to have something similar, we need the ZPM SwaggerUI extension or we need to install IAM - InterSystems API Manager and then configure the IAM Developer Portal. Well, now the community has one more option, iris-redoc. This solution installs a web application on your IRIS instance that uses Redoc to present a beautiful web portal for your REST APIs:

0
4 64