How to Link 2 Infosets Together

 2 Replies
 0 Subscribed to this topic
 14 Subscribed to this forum
Sort:
Author
Messages
Ken Ptak
Basic Member Send Private Message
Posts: 20
Basic Member

I'm trying to create a Smart Note that will list the accounts that exist in the GMDISTRIB that do not have a Record_Type attribute set up on the GL16.2.  Not all accounts should have their Record_Type attribute value assigned, only the accounts in the GMDISTRIB.

I've broken it down into two queries:

1. The first infoset JDBC query pulls a listing of all of the unique accounts that exist in the GMDISTRIB.

SELECT GMDISTRIB.ACCOUNT FROM GMDISTRIB GROUP BY GMDISTRIB.ACCOUNT

2. The second infoset JDBC query pulls all of the Accounts from GLCHARTDTL with a link to GLACCMXVAL for attribute value data.

SELECT GLCHARTDTL.CHART_NAME, GLCHARTDTL.SUMRY_ACCT_ID, GLCHARTDTL.CHART_SECTION, GLCHARTDTL.ACCOUNT, GLCHARTDTL.ACCOUNT_DESC, GLACCMXVAL.MATRIX_CAT, GLACCMXVAL.MX_VALUE FROM GLCHARTDTL LEFT JOIN GLACCMXVAL ON GLCHARTDTL.OBJ_ID = GLACCMXVAL.OBJ_ID WHERE GLCHARTDTL.CHART_NAME='FINANCIALS' ORDER BY GLCHARTDTL.ACCOUNT

My question is, how do I create a Smart Note that will show only the accounts from the first query that have a Record_Type=null from the second query?  Any suggestions would greatly be appreciated.

Thanks for you time!

Ken

John Henley
Send Private Message
Posts: 3351
Ken, I would approach it from the SQL side, and use a query that returns the desired results; something like this (I didn't test this...):
SELECT
GMDISTRIB.ACCOUNT,
GLCHARTDTL.CHART_NAME,
GLCHARTDTL.SUMRY_ACCT_ID,
GLCHARTDTL.CHART_SECTION,
GLCHARTDTL.ACCOUNT,
GLCHARTDTL.ACCOUNT_DESC,
GLACCMXVAL.MATRIX_CAT,
GLACCMXVAL.MX_VALUE
FROM GMDISTRIB

LEFT OUTER JOIN GLCHARTDTL
ON GLCHARTDTL.ACCOUNT = GMDISTRIB.ACCOUNT
AND GLCHARTDTL.CHART_NAME = 'FINANCIALS'

LEFT OUTER JOIN GLACCMXVAL
ON GLACCMXVAL.OBJ_ID= GLCHARTDTL.OBJ_ID
AND GLACCMXVAL.MATRIX_CAT = 'Record_Type'

WHERE GLACCMXVAL.OBJ_ID IS NULL

ORDER BY GMDISTRIB.ACCOUNT
Thanks for using the LawsonGuru.com forums!
John
Ken Ptak
Basic Member Send Private Message
Posts: 20
Basic Member
I had to tweak it slightly but you definitely pointed me in the right direction. Thanks for your help John!

Here's the final result in case anyone else has a similar case:

SELECT GMDISTRIB.ACCOUNT, GLCHARTDTL.ACCOUNT_DESC, GLCHARTDTL.CHART_NAME, GLCHARTDTL.SUMRY_ACCT_ID, GLCHARTDTL.CHART_SECTION, GLCHARTSUM.SUMMARY_ACCT, GLCHARTDTL.ACCOUNT, GLACCMXVAL.MATRIX_CAT, GLACCMXVAL.MX_VALUE

FROM ((GMDISTRIB LEFT JOIN GLCHARTDTL ON GMDISTRIB.ACCOUNT = GLCHARTDTL.ACCOUNT) LEFT JOIN GLACCMXVAL ON GLCHARTDTL.OBJ_ID = GLACCMXVAL.OBJ_ID) LEFT JOIN GLCHARTSUM ON GLCHARTDTL.SUMRY_ACCT_ID = GLCHARTSUM.SUMRY_ACCT_ID

GROUP BY GMDISTRIB.ACCOUNT, GLCHARTDTL.CHART_NAME, GLCHARTDTL.SUMRY_ACCT_ID, GLCHARTSUM.SUMMARY_ACCT, GLCHARTDTL.CHART_SECTION, GLCHARTDTL.ACCOUNT, GLCHARTDTL.ACCOUNT_DESC, GLACCMXVAL.MATRIX_CAT, GLACCMXVAL.MX_VALUE, GLACCMXVAL.OBJ_ID

HAVING GLACCMXVAL.OBJ_ID Is Null

ORDER BY GMDISTRIB.ACCOUNT