This document presents a sample query that, when run using the SOS-supplied DBISQL utility, produces an EXCEL file that can be used as the data to produce a set of mailing labels in MS Word. There is a document on the SOS web site that describes how to run queries:
http://www.sosoft.com/queries/how2010/
Specifically, it selects from the main data set (licnum = 101), only certain primary providers, and only those with a non-zero service within the last 270 days. The results of the query are saved in a file called LABELS.HTML in the SOS folder on the C: drive (see last line of the query). You can copy and paste the query below directly into DBISQL, then make any changes you like before running it.
SELECT
TRIM(a.firstname) AS “First Name”,
TRIM(a.lastname) AS “Last Name”,
a.addr1 AS “Address 1”,
a.addr2 AS “Address 2”,
TRIM(city) AS “City”,
TRIM(state) AS “State”,
zip
FROM
rv_patients a
JOIN ptvars b ON a.ptnum = b.ptnum
WHERE
a.licnum = 101
AND a.priprvcode IN (‘AB’,’CD’,’EF’,’GH’)
AND b.lfeedate > (TODAY() – 270)
ORDER BY
a.lastname, a.firstname
;
OUTPUT TO c:\sos\labels.html FORMAT HTML
Once you have run your query successfully, open the resulting XLS file in MS EXCEL and re-save it. That will put it into the file format that your particular version of MS Word likes best. Now open your web browser and go to:
http://www.sosoft.com/files/tv/other/querylabelmerge.swf
to view a short Flash video that demonstrates how to create your labels using the output of your query. Depending on the speed of your internet connection, the video may take a while to load. (If you don’t have the Flash add-in installed, your browser will probably offer to download and install it for
you.)
Leave a Reply
You must be logged in to post a comment.