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: 28

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

You must be logged in to reply to this topic.

Blue Elm Eventts

August 2019
S M T W T F S
« Aug    
 123
45678910
11121314151617
18192021222324
25262728293031