Looping on multiple or all databases

Home/Support/OpenGate/Looping on multiple or all databases

Home Forums Support OpenGate Looping on multiple or all databases

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Shawn Kenny
    Keymaster
    Post count: 27

    The following query will return the urn,name, and acct.number for all patients admitted(in a room and bed) across multiple MEDITECH ADM databases. This same logic can be applied to any query but the “where” statement would change to reflect the MIS databases you would like to loop on. For example if you wanted to loop through PHA databases – “WHERE MIS.APPL.database LIKE ‘PHA%'”

    Query Ex:
    `
    Select
    MIS.APPL.database,
    ADM.PAT.urn,
    ADM.PAT.name,
    ADM.PAT.acct.number
    FROM MIS.APPL.main
    JOIN ADM.PAT.room.bed.index ON MIS.APPL.main
    JOIN ADM.PAT.main
    WHERE MIS.APPL.database LIKE “ADM%”
    AND { MIS.APPL.database=IF{O(#X),IF{O(%X),%.ADO.OPEN.DB(@MIS.APPL.database,”O(%X)”)}^ADO.ERR,
    K(/[“ADO”].DB),M(#DB,/[“ADO”].DB),O(#X),ADO.ERR;MIS.APPL.database} }

    • This topic was modified 2 years, 6 months ago by  Shawn Kenny.
    • This topic was modified 1 year, 10 months ago by  Shawn Kenny.
    • This topic was modified 1 year ago by  Shawn Kenny.
    • This topic was modified 1 year ago by  Shawn Kenny.
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Blue Elm Eventts

December 2018
S M T W T F S
« Aug    
 1
2345678
9101112131415
16171819202122
23242526272829
3031