To find the max recordID we have sent to CIHI for RVC OMHRS you would run this query:



select MAX(recordid) from TR_SubmissionEntityRecID
where OrgID = 1700 and SubmissionDefID = 100



The meaning of the columns in TR_SubmissionEntityRecID:
  1. EntityID is the assessmentID in TREAT.  If the EntityID has a hyphen (eg. 1234-01234567) then the 1st part is the assessmentID and the 2nd part is the DIN recorded for a medication in that assessment.
  2. RecordID is incremented by 1 each time for every assessment/medication sent to CIHI across all submissions (OMHRS, NRS, etc). e.g. if there is an OMHRS file of 100 records, it may have recordIDs 100-199.  If the next submission by RVC is NRS and it has 50 records, it will use recordIDs 200-249.  The only requirement is that RecordID is unique at CIHI for that org and submission