I have a simple ListBoxResult function on a form that translates checkbox values into paragraph form and puts them into the OBSNOW value of an Obs Term. I also have a multi-line edit field displaying the Obs Term's current value for users to freetext edits into.
The problem I have is: If a user types in the multi-line edit field then clicks any checkboxes, the typed values are overwritten. If the user clicks then types, the form works.
Below is my function. I'm sure it's an easy fix, but one that is eluding me at the moment.
Thanks
{fn ListBoxResult(l1str,l2str,l3str,l4str,l5str,l6str,l7str,l8str,l9str,l10str,l11str,l12str,l13str,l14str,l15str,l16str,l17str,l18str,l19str,l20str,l21str,l22str,l23str,l24str,l25str,l26str,l27str,l28str,l29str,l30str,l31str,l32str,l33str,l34str,l35str,l36str,l37str,l38str,l39str,l40str,l41str,l42str,l43str,l44str,l45str,l46str) { local fullStr = "" if (size(l1str) > 0) then fullStr = fullStr + "Please schedule a follow up appointment in " + l1str endif if (size(l2str) > 0) then fullStr = fullstr + " " + l2str + ". " + HRET endif if (size(l3str) > 0) then fullstr = fullstr + l3str + ". " + HRET endif if (size(l4str) > 0) then fullstr = fullstr + l4str + ". " + HRET endif if (size(l5str) > 0) then fullstr = fullstr + l5str + ". " + HRET endif if (size(l6str) > 0) then fullstr = fullstr + l6str + ". " + HRET endif if (size(l7str) > 0) then fullstr = fullstr + l7str + ". " + HRET endif if (size(l8str) > 0) then fullstr = fullstr + l8str + ". " + HRET endif if (size(l9str) > 0) then fullstr = fullstr + l9str + ". " + HRET endif if (size(l10str) > 0) then fullstr = fullstr + l10str + ". " + HRET endif if (size(l11str) > 0) then fullstr = fullstr + l11str + ". " + HRET endif if (size(l12str) > 0) then fullstr = fullstr + l12str + ". " + HRET endif if (size(l13str) > 0) then fullstr = fullstr + l13str + ". " + HRET endif if (size(l14str) > 0) then fullstr = fullstr + l14str + ". " + HRET endif if (size(l15str) > 0) then fullstr = fullstr + l15str + ". " + HRET endif if (size(l16str) > 0) then fullstr = fullstr + l16str + ". " + HRET endif if (size(l17str) > 0) then fullstr = fullstr + l17str + ". " + HRET endif if (size(l18str) > 0) then fullstr = fullstr + l18str + ". " + HRET endif if (size(l19str) > 0) then fullstr = fullstr + l19str + ". " + HRET endif if (size(l20str) > 0) then fullstr = fullstr + l20str + ". " + HRET endif if (size(l21str) > 0) then fullstr = fullstr + l21str + ". " + HRET endif if (size(l22str) > 0) then fullstr = fullstr + l22str + ". " + HRET endif if (size(l23str) > 0) then fullstr = fullstr + l23str + ". " + HRET endif if (size(l24str) > 0) then fullstr = fullstr + l24str + ". " + HRET endif if (size(l25str) > 0) then fullstr = fullstr + l25str + ". " + HRET endif if (size(l26str) > 0) then fullstr = fullstr + l26str + ". " + HRET endif if (size(l27str) > 0) then fullstr = fullstr + l27str + ". " + HRET endif if (size(l28str) > 0) then fullstr = fullstr + l28str + ". " + HRET endif if (size(l29str) > 0) then fullstr = fullstr + l29str + ". " + HRET endif if (size(l30str) > 0) then fullstr = fullstr + l30str + ". " + HRET endif if (size(l31str) > 0) then fullstr = fullstr + l31str + ". " + HRET endif if (size(l32str) > 0) then fullstr = fullstr + l32str + ". " + HRET endif if (size(l33str) > 0) then fullstr = fullstr + l33str + ". " + HRET endif if (size(l34str) > 0) then fullstr = fullstr + l34str + ". " + HRET endif if (size(l35str) > 0) then fullstr = fullstr + l35str + ". " + HRET endif if (size(l36str) > 0) then fullstr = fullstr + l36str + ". " + HRET endif if (size(l37str) > 0) then fullstr = fullstr + l37str + ". " + HRET endif if (size(l38str) > 0) then fullstr = fullstr + l38str + ". " + HRET endif if (size(l39str) > 0) then fullstr = fullstr + l39str + ". " + HRET endif if (size(l40str) > 0) then fullstr = fullstr + l40str + ". " + HRET endif if (size(l41str) > 0) then fullstr = fullstr + l41str + ". " + HRET endif if (size(l42str) > 0) then fullstr = fullstr + l42str + ". " + HRET endif if (size(l43str) > 0) then fullstr = fullstr + l43str + ". " + HRET endif if (size(l44str) > 0) then fullstr = fullstr + l44str + ". " + HRET endif if (size(l45str) > 0) then fullstr = fullstr + l45str + ". " + HRET endif if (size(l46str) > 0) then fullstr = fullstr + l46str + ". " + HRET endif return fullstr} } {!OBSNOW("INSTRUCTIONS", ListBoxResult(DOCUMENT.NUMBER_OF, DOCUMENT.LENGTH, DOCUMENT.CAWTHORNE, DOCUMENT.EPISTAXIS, DOCUMENT.LPR, DOCUMENT.MENIERES, DOCUMENT.SINUS_SUG_IRRIGAT, DOCUMENT.SALT, DOCUMENT.SLEEP_STUDY, DOCUMENT.WOUND_CARE, DOCUMENT.PRN, DOCUMENT.AS_SCHEDULED, DOCUMENT.CT, DOCUMENT.CT_IN_HOUSE, DOCUMENT.CT_PET, DOCUMENT.U_S, DOCUMENT.SCHED_SURG, DOCUMENT.WILL_CALL_SCHED_SURG, DOCUMENT.WILL_CALL_PT_RESULTS, DOCUMENT.PT_THINKING, DOCUMENT.CONT_PRESENT_TREAT_MEDS, DOCUMENT.INTERPRETER, DOCUMENT.FU_BREVARD, DOCUMENT.FU_HVL, DOCUMENT.FU_MARION, DOCUMENT.NO_CHARGE, DOCUMENT.NOTE_TO_REF_MD, DOCUMENT.NOTE_TO_PCP, DOCUMENT.NOTE_TO, DOCUMENT.POST_OP_VISIT, DOCUMENT.JUDY_WELCH, DOCUMENT.UPDATE_INFO, DOCUMENT.TYMP_ONLY, DOCUMENT.NO_AUDIO, DOCUMENT.AUDIO_RETURN, DOCUMENT.ABR, DOCUMENT.ECOG, DOCUMENT.VNG, DOCUMENT.HAE, DOCUMENT.TWO_PERSON_AUDIO, DOCUMENT.TYMP_RETURN, DOCUMENT.HA_BROCHURE, DOCUMENT.MOD_MED, DOCUMENT.SEV_MED, DOCUMENT.MOD_PT, DOCUMENT.SEV_PT))}
I don't think there is a simple fix for this, the easiest thing to do is tell the docs to check boxes first, type additions or changes second. But from my experience docs dont like that answer. An easy setup to get around this problem is a series of action buttons that are set to connection type SETVALUES and existing value: Append to. The downside is space requirements on the form for more buttons, and you can't just uncheck the button to remove the statement. Advantage is you dont overwrite existing statements or handtyped statements.
There are ways to write more advanced functions that will not overwrite everything when you change a listbox selection, but I havent found a method that is perfect and I have my doubts that it exists. For example, a function that uses replacestr(variable name, old value, new value) is a start, for 11str you would need to also remove the rest of the statement if new value is blank. You obviously would need to add a way to save the old value of a variable.... You need to be able to just add it if old value is blank, and possibly add it in a specific order. It gets complicated pretty quick.
Sam - This is possible, I did it once, but it was not easy. And building something fancy is a headache to maintain. I'd recommend finding a solution that is more straightforward to program and still acceptable to the user. For example: instead of tyin the multiline textbox directly to the OBS value, tie it to a document variable and label it "additional things not in the list". In your code combine the list items + multiline text and save into OBSNOW. You could have a data field show the current value for OBSNOW so the user can see the result of the two combined.
Justin
I have a form needing the same functionality. Does anyone have an example?
If so email [email protected]
thank you!