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, 4 months ago by  Shawn Kenny.
    • This topic was modified 1 year, 8 months ago by  Shawn Kenny.
    • This topic was modified 10 months, 1 week ago by  Shawn Kenny.
    • This topic was modified 10 months, 1 week ago by  Shawn Kenny.
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Blue Elm Eventts

October 2018
S M T W T F S
« Aug    
 123456
78910111213
14151617181920
21222324252627
28293031