I have never found a place that documents these, but I use them quite a bit and can try to share what i have figured out.
Both functions along with the find() function are great for writing custom functions. They query objects that GE defines seperately from the sql tables, the names and defintions are in the mldefs.txt files in the client folder. One of the most difficult parts about writing these functions is choosing the correct object. I dont really have any great advice for choosing these, you will just have to read the descriptions and try to figure out which one best fits your needs.
GETROWCOUNT() takes a single argument, which has to be the name of an object defined in meldefs, it is used to determine the size of a loop for the getrow function
GETROW() requires at least three arguments, I don't believe there is a maximum. The first argument is the object name, the second is the row number (usually i for the loop) and then every other argument is a field or formula name in the object
find() is defined in the data symbols reference, for these functions we will use the four argument version.
Examples:
local a = GETROWCOUNT("_MasterRx")
a is now a number representing the number of items in the object named "_MasterRx", this object is defined in mldefs.txt and is a subset of the PRESCRIB table
for i = 0, i < a, i = i + 1 do
b = getrow("_MasterRx",i,"MID","Quantity","Refills")
//Do something here
endfor
b is now an array with three elements, MID, Quantity, and Refills, representing a row i in the object "_MasterRx"
the for loop will return an array for every row in this object.
find("_MasterMed","Description","MID",b[1])
Find is used to link objects together. This find statement reads find in the mastermed object the description field where the MID is equal to the first element of the MasterRx array (which we defined as the MID).
So putting it together -
{fn Custom_Med_Array(){
local a = GETROWCOUNT("_MasterRx")
local b = ""
local result = ""
for i = 0, i < a, i = i + 1 do
b = getrow("_MasterRx",i,"MID","Quantity","Refills")
if result <> "" then
result = result + "|"
endif
result = result + find("_MasterMed","Description","MID",b[1]) + "^" + find("_MasterMed","Instructions","MID",b[1]) + "^" + b[3] + "^" + b[4]
endfor
return result
}}
So this example counts the rows, loops through each row collecting MID, Quantity, and Refills, uses the MID to find the description and instructions for each med, and then puts in into string delimited by carrots and pipes that you could use for something else, the formatting is ultimately up you. Hope this helps
Mike
Posted : April 18, 2013 5:44 am