Agree with Sam's post.
A quick note on insertion position of encounter forms:
To the EMR, the 'anchor position' is determined by the last form 'work' was performed in, aka the form that holds focus. Unfortunately, some components of a form do not capture/transfer focus. Examples are: Action buttons (depending on action), Previous Next Buttons, and the Close Button.
A common 'error' is to present a button on a form that initially opens with the update (i.e. HPI) that users commonly utilize to 'jump' to another form (i.e. Vitals). The 'jumped to' for then permits adding additional forms via action button with the intent of adding the form immediately after the 'jumped to' form.
Here is what is happening in the EMR and why this approach produces unexpected results:
1) The EMR focus is on the initial form
2) When nothing is done but clicking the action button to jump to another form, the jump is made but focus remains on the initial form
3) When adding a form from the second form, the EMR uses the first form as the 'anchor form' and inserts based on that forms position, not the form you are inserting from.
A crude method to overcome this issue is to instruct your users to always click an item on a form prior to engaging the jump or insert buttons. This forces the focus to change to the active form.
An alternate (and better) method would be to write a function that recognizes the current position being launched from and executing the add command using that position. You would use the function in the action button instead of the add_form_component data symbol.
An example of said function:
Argument Legend:
strAnchorForm = The form you want to position around – if null, only AT_BEGINNING and AT_END will be used
strNewForm = The name of the form you are inserting
strNewFormPath = The path of the form you are inserting. Use / instead of and DO NOT add a trailing / (Do use if / will not work)
strPosition = Uses the default AT_BEGINNING, BEFORE_CURRENT, AFTER_CURRENT, AT_END formats
strOpen = "OPEN" if form is to be added and opened, "" (NULL) if it is only to be added
strTab = TAB Name on form IF it already exists in the update
Function:
fnInsertForm_(strAnchorForm,strNewForm,strNewFormPath,strPosition,strOpen,strTab)
{
local strForms
local nForms
local count
local nAnchorFormLoc
local strNewFormList
local nInsertPos
local strFormPath
strForms = getfield(GET_FORM_LIST(),"|","")
if match(toupper(str(strForms)),toupper(strNewForm)) == 0 then
nForms = size(strForms)
for count=1, count <= nForms, count = count + 1 DO
if match(toupper(strForms[count]),toupper(strAnchorForm)) > 0 then
nAnchorFormLoc = count
break
else ""
endif
endfor
cond
case toupper(strPosition)== "AFTER_CURRENT" nInsertPos = nAnchorFormLoc + 1
case toupper(strPosition)== "AT_END" nInsertPos = nForms + 1
case toupper(strPosition)=="BEFORE_CURRENT" nInsertPos = nAnchorFormLoc
case toupper(strPosition)=="AT_BEGINNING" nInsertPos = 1
else
nInsertPos = nForms
endcond
if strOpen <> "" then
ADD_FORM_COMP(strNewFormPath,strNewForm,str(nInsertPos),strOpen)
else
ADD_FORM_COMP(strNewFormPath,strNewForm,str(nInsertPos))
endif
else
if match(toupper(str(strForms)),toupper(strNewForm)) > 0 then
strFormPath = str(strNewFormPath + sub(" ",1,1) + strNewForm)
if strTab <> "" then
OPEN_FORM_COMP(strFormPath,strTab)
else
OPEN_FORM_COMP(strFormPath)
endif
else ""
endif
endif
return ""
}
Posted : March 20, 2013 5:18 am