Question
· Dec 2

How to use order by in Query %DLIST ?

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

LEFT JOIN SQLUser.OE_Order ON PAADM_RowID = OEORD_Adm_DR

LEFT JOIN SQLUser.OE_OrdItem AS OD1 ON OEORD_RowId = OEORI_OEORD_ParRef AND OEORI_Categ_DR = 20 AND OEORI_ItemStat_DR <> 1

LEFT JOIN SQLUser.OE_OrdItem AS OD2 ON OEORD_RowId = OD2.OEORI_OEORD_ParRef AND OD2.OEORI_Categ_DR = 11 AND OD2.OEORI_ItemStat_DR <> 1

WHERE

PAADM_ADMNo IS NOT NULL AND PAADM_Type = 'E'

AND PAADM_AdmDate >= '2024-11-01' AND PAADM_AdmDate <= '2024-11-25'

GROUP BY PAADM_RowId

and this is the result

and What I need is how to order by the Diagnose Colum like (M) for the first and (S) for second and (C008) for the last ?

like this one

Does anyone could help me ? 

Thank You

Best Regards,

Steve Henry

Product version: IRIS 2024.3
$ZV: $ZV: IRIS for UNIX (Red Hat Enterprise Linux 8 for x86-64) 2023.1.1 (Build 380_0_23477U) Wed Jun 12 2024 18:10:40 EDT [Health:5.1.0-1.m1
Discussion (0)1
Log in or sign up to continue