Is there a way to append text to a multi line edit field using a runprocess button?
I have 2 buttons that each have some text that I want to insert into a single comment field. If I click the buttons, each one overwrites the text each time. Is there a way to append to the field using MEL?
Have you tried to concatenate the new values with the existing comments.
DOCUMENT.COMMENTS = DOCUMENT.COMMENTS + "this is the new text to add" + DOCUMENT.ADDTL_FIELD + DOCUMENT.ADDTL_FIELD2
This being a quick example, you would need to organize the new text, fields, etc but have the original DOCUMENT.COMMENTS as part of the concatenated string which would be assigned to the DOCUMENT.COMMENTS variable
I generally append 2 fields together this way...
Example, For 2 comment fields named: COM1 and COM2
If DOCUMENT.COMMENT is defined on the form
you can add to DOCUMENT.COMMENT,
otherwise just define a local variable to use here:
local thisCOMMENT
DOCUMENT.COMMENT= OR thisComment=
= DOCUMENT.COM1
+ (if DOCUMENT.COM1<>"" AND DOCUMENT.COM2<>"",HRET,"")
+ DOCUMENT.COM2
The middle bit above in the (....) will insert a hard return HRET,
between the comments if both COM1 AND COM2 have values,
otherwise it just adds nothing "".
Then in your MEL_ADD_ORDERS, if you wanted that comment added:
MEL_ADD_ORDER("S", "Injections", "Kenalog 40 MG", "", "", ""
, DOCUMENT.COMMENT, "", "", "", "")
OR
MEL_ADD_ORDER("S", "Injections", "Kenalog 40 MG", "", "", ""
, thisComment, "", "", "", "")
NOTE: In the RUNPROCESS, I would enclose the entire code block
between { ... }
- Beverly
This is off the top of my head and I didn't test it, so you mileage may vary, but you will get the idea. Something like this (with the textbox as document.comment):
{
local rgtinjection = "This is my boilerplate text."
if (document.comment == "") then
document.comment = rgtinjection
else
document.comment = document.comment + " " +rgtinjection
endif
}
You can then take the same code and swap the 'rgtinjection' with 'lftinjection' or whatever you want to call the variable and put it in the other button. This will keep appending text if you click the buttons more than once, but you can setup a variable in the enable section of the button properties to turn the button off after one click to prevent that.
Brad
That works perfect Brad. Thank you!