I've had an hour or two of MEL training that did not cover the use of arrays. I've been experimenting to figure them out, but it's very cumbersome to import a document every time I want to try a variation of my code. I'm coming from a background in visual basic script (and old-school basic).
Can anyone tell me where to find training/examples of the use of arrays? Some particular questions:
1. is an array saved as a string separated by pipes and carrots, or is this just how problems details are saved?
2. Are OBS terms automatically stored in an array with the document date as the first dimension?
3. It looks like the syntax for multi-dimensional arrays is stringname[dimension1][dimension2]… Is this right?
I could go on, but I'm hoping someone has a useful training document that would get me started. Any help would be appreciated. Thanks.
As long as you are not using Document variables/fields, you can program MEL into Letters to practice your code. It's a lot faster than importing forms.
I have a zDev folder in Letters where I practice MEL bits then you can go to a patient's chart, click Print, navigate to your zDev, pick your "letter" and see the outcome.
Multidimensional arrays are almost always stored as ^^|^^|^^|.
First array node is referred to as 1, not 0.
Here's one I wrote this morning to pull all the dxs I've put on a Problem Custom List and list them in a checkbox for uses to select.
//COVID 19 Testing Signs and Symptoms
//Build the SARS CoV3 COVID 19 SX Dx list
//Pull details from the problem custom list -- descIn = 'all' if you want dx string
{!fn fnFetchPCL(){
local retWhat = ""
local pclA = PROBLEM_CUST_LIST("SARS CoV2 COVID19 Sx")
pclA = getfield(pclA,"|", "")
for x = 1, x <= size(pclA), x = x + 1
do
local thisP = getfield(pclA[x],"^","")
local this10 = thisP[4]
this10 = replacestr(this10,"ICD10-","")
local thisD = thisP[1]
thisD = replacestr(thisD,",","")
//1 = desc
//2 = icd9
//3 = duration
//4 = icd10
local sep = ""
if (retWhat "") THEN sep = "," else sep = "" ENDIF
retWhat = retWhat + sep + this10 +": " + thisD
endfor
return retWhat
}}
Regarding obs (well and any data really), it isn't that it is stored in Centricity in an array but rather the Data Symbols we use to work with data return the data as arrays. Off the top of my head, when working with the clinical list data symbols (probs/meds/allergies etc...), the most useful ones return dimensional arrays with the outer dimensions being delimited with pipes '|' and the inner dimensions delimited with carats '^'.
If you're working with arrays, you should get very familiar with the Data Symbol GETFIELD(). The help documentation in CPS regarding data symbols isn't perfect but it's pretty decent. If you look at the GETFIELD() symbol in help it will start to shed light on this stuff.