Automatting Data Lookup Table Import
Is there a way to have a Data Lookup table be automatically updated via a script or cache code? We have a file that is being created by our EMR, and we need to import it into Ensemble to update it. Just trying to see if we can automate this process.
Thanks
Scott Roth
Ohio State University Wexner Medical Center
class Ens.Util.LookupTable has %Import and %Export methods. You can use %Export to export an existing table to see the format expected by %Import.
Another option is to import a csv file using the SQL Data Import Wizard. You can find that at System Explorer -> SQL and then click the 'Wizards' link at the top and choose Data Import. I believe the csv file needs 3 columns: tablename, key, value. The table name gets repeated for every row. I'm not sure if this can be automated.
The last option is to edit the globals directly. Ens.Util.LookupTable doesn't use standard default storage. Instead, everything is stored in ^Ens.LookupTable with this format:
^Ens.LookupTable("TableName","key")="value"
The last two options break the abstraction barrier so if the way lookup tables are stored ever changes, they'll stop working. %Import and %Export are preferred.
Export via $system.OBJ.Export(<LookupTableName>,<FilePath and FileName>).
The extension is ".lut". A LookupTable "TestLookupTable" can be exported as follows:
Import the exported LookupTable with $system.OBJ.Import() or any means available like Studio or System Management Portal.
Packaging a LookupTable within a project:
Include the "*.lut" in a Studio Project. Then the LookupTable can be exported with other relevant development objects.
This is how the LookupTable is projected to a Studio Document: