Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

any idea why this command line isn't working? 1

Status
Not open for further replies.

scottaherbst

Technical User
Jan 18, 2007
46
0
0
US
I'm using CR10, SQL server DB. I'm getting an error message "Failed to open a rowset... UNKNOWN MSG." Any ideas what I've got wrong.

SELECT view_episode_summary_current.PATID, view_episode_summary_current.program_code,
View_episode_summary_current.EPISODE_NUMBER,
View_episode_summary_current.preadmit_admission_date,
View_episode_summary_current.program_X_RRG_code,
LOCUS_Adult_Assessment.functional_status,
LOCUS_Adult_Assessment.PATID,
LOCUS_Adult_Assessment.EPISODE_NUMBER,
LOCUS_Adult_Assessment.rating_date
FROM SYSTEM.view_episode_summary_current
View_episode_summary_current LEFT OUTER JOIN SYSTEM.LOCUS_Adult_Assessment LOCUS_Adult_Assessment ON ((view_episode_summary_current.PATID = LOCUS_Adult_Assessment.PATID) AND (View_episode_summary_current.EPISODE_NUMBER = LOCUS_Adult_Assessment.EPISODE_NUMBER))
WHERE Locus_Adult_Assessment.rating_date = (SELECT MAX(A.rating_Date) FROM SYSTEM.LOCUS_ADULT_ASSESSMENT A, SYSTEM.View_Episode_Summary_Current B
WHERE A.PATID = B.PATID AND A.episode_number = B.Episode_number) AND View_episode_summary_current.program_X_RRG_code = {?RRG}
ORDER BY view_episode_summary_current.PATID,
LOCUS_Adult_Assessment.rating_date
 
Try removing parts of the where clause until you no longer get the message. If View_episode_summary_current.program_X_RRG_code is a string then you should enclose the parm with single quotes as in: '{?RRG}'

I thought you wanted to look at the most recent date per patient? I think you need to change the clause to:

WHERE Locus_Adult_Assessment.rating_date = (SELECT MAX(A.rating_Date) FROM SYSTEM.LOCUS_ADULT_ASSESSMENT A, SYSTEM.View_Episode_Summary_Current B
WHERE A.PATID = SYSTEM.LOCUS_ADULT_ASSESSMENT.PATID AND
A.PATID = B.PATID AND
A.episode_number = B.Episode_number)

-LB
 
It works. Thanks. Weird, though. I've run a ton of reports with that same parameter referencing the same field and I haven't had to do that before.
 
To clarify--You only need the single quotes for string parameters in a command. If you were doing this in the CR record selection area, you wouldn't need the quotes.

-LB
 
No, I've used it w/out quotes a bunch of times in a command line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top