I have a data display which displays ORDERS_NEW. I am having a problem where the first order added does not display correctly. If I enter 2 service orders, let's say
ORDER1 [CPT 97110]
ORDER2 [CPT 97140]
it displays as
[97110]
ORDER2 [97140]
The first order description is not coming through. The MEL trace looks like this:
04/11/2016 11:13:41.433-results>"Ther exercise, 15 min^S^CPT-97110^04/11/2016^^ACL TEAR^ICD-844.2^^^^1^^ ^^^\r\n^^^^U^Harry S. Winston MD^UNSIGNED^^^293-1^ICD10-S83.511"
04/11/2016 11:13:41.433-execute>call GETFIELD("Ther exercise, 15 min^S^CPT-97110^04/11/2016^^ACL TEAR^ICD-844.2^^^^1^^ ^^^\r\n^^^^U^Harry S. Winston MD^UNSIGNED^^^293-1^ICD10-S83.511", "^", "")
04/11/2016 11:13:41.433-results>Array
04/11/2016 11:13:41.433-execute>ORDERSUB = Array
04/11/2016 11:13:41.433-results>Array
04/11/2016 11:13:41.433-execute>Array[4]
04/11/2016 11:13:41.433-results>"04/11/2016"
04/11/2016 11:13:41.433-execute>call STR(04/11/2016)
04/11/2016 11:13:41.433-results>"04/11/2016"
04/11/2016 11:13:41.433-execute>call MATCH("04/11/2016", "04/11/2016")
04/11/2016 11:13:41.433-results>1
04/11/2016 11:13:41.433-execute>1 > 0
04/11/2016 11:13:41.433-results>TRUE
04/11/2016 11:13:41.433-execute>if TRUE
04/11/2016 11:13:41.433-results>TRUE
04/11/2016 11:13:41.433-execute>Array[1]
04/11/2016 11:13:41.433-results>"Ther exercise, 15 min"
04/11/2016 11:13:41.433-execute>VOID + "Ther exercise, 15 min"
04/11/2016 11:13:41.433-results>NULL
04/11/2016 11:13:41.433-execute>NULL + " ["
04/11/2016 11:13:41.433-results>" ["
04/11/2016 11:13:41.433-execute>Array[3]
04/11/2016 11:13:41.433-results>"CPT-97110"
04/11/2016 11:13:41.433-execute>" [" + "CPT-97110"
04/11/2016 11:13:41.433-results>" [CPT-97110"
04/11/2016 11:13:41.433-execute>" [CPT-97110" + "]"
04/11/2016 11:13:41.433-results>" [CPT-97110]"
04/11/2016 11:13:41.433-execute>" [CPT-97110]" + "\r\n"
04/11/2016 11:13:41.433-results>" [CPT-97110]\r\n"
04/11/2016 11:13:41.433-execute>RESULT = " [CPT-97110]\r\n"
04/11/2016 11:13:41.433-results>" [CPT-97110]\r\n"
04/11/2016 11:13:41.433-execute>27 + 1
04/11/2016 11:13:41.433-results>28
04/11/2016 11:13:41.433-execute>COUNT = 28
04/11/2016 11:13:41.433-results>28
04/11/2016 11:13:41.433-execute>call SIZE(Array)
04/11/2016 11:13:41.433-results>28
04/11/2016 11:13:41.433-execute>28 TRUE
04/11/2016 11:13:41.433-execute>for TRUE
04/11/2016 11:13:41.433-results>TRUE
04/11/2016 11:13:41.433-execute>Array[28]
04/11/2016 11:13:41.433-results>"Ther exercise, 30 min^S^CPT-97110^04/11/2016^^ACL TEAR^ICD-844.2^^^^2^^ ^^^\r\n^^^^U^Harry S. Winston MD^UNSIGNED^^^293-2^ICD10-S83.511"
04/11/2016 11:13:41.433-execute>call GETFIELD("Ther exercise, 30 min^S^CPT-97110^04/11/2016^^ACL TEAR^ICD-844.2^^^^2^^ ^^^\r\n^^^^U^Harry S. Winston MD^UNSIGNED^^^293-2^ICD10-S83.511", "^", "")
04/11/2016 11:13:41.433-results>Array
04/11/2016 11:13:41.433-execute>ORDERSUB = Array
04/11/2016 11:13:41.433-results>Array
04/11/2016 11:13:41.433-execute>Array[4]
04/11/2016 11:13:41.433-results>"04/11/2016"
04/11/2016 11:13:41.433-execute>call STR(04/11/2016)
04/11/2016 11:13:41.434-results>"04/11/2016"
04/11/2016 11:13:41.434-execute>call MATCH("04/11/2016", "04/11/2016")
04/11/2016 11:13:41.434-results>1
04/11/2016 11:13:41.434-execute>1 > 0
04/11/2016 11:13:41.434-results>TRUE
04/11/2016 11:13:41.434-execute>if TRUE
04/11/2016 11:13:41.434-results>TRUE
04/11/2016 11:13:41.434-execute>Array[1]
04/11/2016 11:13:41.434-results>"Ther exercise, 30 min"
04/11/2016 11:13:41.434-execute>" [CPT-97110]\r\n" + "Ther exercise, 30 min"
04/11/2016 11:13:41.434-results>" [CPT-97110]\r\nTher exercise, 30 min"
04/11/2016 11:13:41.434-execute>" [CPT-97110]\r\nTher exercise, 30 min" + " ["
04/11/2016 11:13:41.434-results>" [CPT-97110]\r\nTher exercise, 30 min ["
04/11/2016 11:13:41.434-execute>Array[3]
04/11/2016 11:13:41.434-results>"CPT-97110"
04/11/2016 11:13:41.434-execute>" [CPT-97110]\r\nTher exercise, 30 min [" + "CPT-97110"
04/11/2016 11:13:41.434-results>" [CPT-97110]\r\nTher exercise, 30 min [CPT-97110"
04/11/2016 11:13:41.434-execute>" [CPT-97110]\r\nTher exercise, 30 min [CPT-97110" + "]"
04/11/2016 11:13:41.434-results>" [CPT-97110]\r\nTher exercise, 30 min [CPT-97110]"
04/11/2016 11:13:41.434-execute>" [CPT-97110]\r\nTher exercise, 30 min [CPT-97110]" + "\r\n"
04/11/2016 11:13:41.434-results>" [CPT-97110]\r\nTher exercise, 30 min [CPT-97110]\r\n"
04/11/2016 11:13:41.434-execute>RESULT = " [CPT-97110]\r\nTher exercise, 30 min [CPT-97110]\r\n"
It happens no matter which order I enter first. Then, to complicate things, the orders are not pushing through correctly and have to be manually pushed.
This is on a custom form so I don't know if I have named a global variable that is somehow interacting with this. Anyone have any suggestions?
04/11/2016 11:13:41.433-execute>VOID + “Ther exercise, 15 min”
04/11/2016 11:13:41.433-results>NULL
This is the problem, I dont think you are initializing your result variable. Before you start the loop you should have a line of code that says -
local RESULT = ""
Or whatever the name of the variable is that you are using to build the result, I'm not positive that is what you are using so you may need to adjust it. Then I think it should work. If not post the function and we can probably find it.
Thank you. That MEL trace is actually not a function, but just a data display tied to clinical function -- > Orders_New so it is the stock GE MEL.
One thing I figured out is that I do have a function that looks like it is interacting. It has the global variable
Ordercount = 0
that I was using for a looping array. Once I set that to
local Ordercount = 0
the problem resolved itself. Have you ever seen this before? A declared global variable interacting with a global variable with a stock GE function?
Declaration of variables is, in my opinion, one of the most critical tasks when coding in MEL (and sadly, often the least emphasized). It is important to know that unless a variable is declared as 'local', it is assumed to be global. Moreover, most times, an undefined variable introduced into the code will be seen as 'NULL', meaning when you reference it, it has no value, not even empty (we use "" to represent that). This can produce odd results when building strings, giving the impression of 'missing data' when in fact, it is not missing, it is being stored in an undefined space.
My suggested rule: ALWAYS specify intent. Use 'global' or 'local' to define and declare any new variable regardless if it is code in a function or code in a data display or code in a button. If the latter two as local or any as global, be sure to use unique names or risk collision with other code.
Thank you for the thoughtful responses. Yes, after this issue popped up, I am going to begin doing exactly what you said, defining every single variable as local or global. I was getting the NULL value in that MEL trace for the stock GE ORDERS_ALL data symbol so I figured it must have been related to a variable I was using.
The issue we were trying to remedy is that when adding an Order with this custom form loaded into the update, the Order adds appropriately but once the document is signed, it doesn't get pushed through to CPS / LinkLogic. I declared the variable in my function as local so hopefully that solves the issue.