We have a case tracking system in place where the users can add notes to a memo field. The are very important as no case is assigned to any one worker.
The memo filed is on our "cb_header" record. This table is VERY heavily used. All data is on the server. Users are using runtime.
What appears to be happening is that if one worker is saving a record at EXACTLY the same time as another worker is saving a completely different record, the memo data from one overwrites the info in the other. This is becoming more of an issue as the system usage becomes heavier. The data that overwrites the other data is, however, saved properly to its own record. This is why I don't think it is a record locking issue, but more of a variable space problem where one user is grabbing another person's variable space. I don't understand how, but that is what I think is going on.
The following is a snippet of code where the workers will be entering their information into a variable, then when all the data entry is done, the data is retrieved, and the memo field is copied out to a local variable, the newly created text is wrapped with a header and footer, then the old text is appended to the new text and the whole thing is written back out to the record. The code is controlling the change_begin and change_end of the table, so I really can't see where this should be happening. The code is executed from a button on a form that is opened in "view" mode.
If anyone can see how this corruption could be happening in the attached code, please let me know.
Thanks,
Tom
The memo filed is on our "cb_header" record. This table is VERY heavily used. All data is on the server. Users are using runtime.
What appears to be happening is that if one worker is saving a record at EXACTLY the same time as another worker is saving a completely different record, the memo data from one overwrites the info in the other. This is becoming more of an issue as the system usage becomes heavier. The data that overwrites the other data is, however, saved properly to its own record. This is why I don't think it is a record locking issue, but more of a variable space problem where one user is grabbing another person's variable space. I don't understand how, but that is what I think is going on.
The following is a snippet of code where the workers will be entering their information into a variable, then when all the data entry is done, the data is retrieved, and the memo field is copied out to a local variable, the newly created text is wrapped with a header and footer, then the old text is appended to the new text and the whole thing is written back out to the record. The code is controlling the change_begin and change_end of the table, so I really can't see where this should be happening. The code is executed from a button on a form that is opened in "view" mode.
If anyone can see how this corruption could be happening in the attached code, please let me know.
Code:
Dim P as P dim aa as P delete sumnotes delete p_text aa = addin.variables() varinit() workerbyempid() vMode = parentform.mode_get() debugcheck() IF vMode = "CHANGE" .or. vMode = "ENTER" parentform.commit() END IF tbl = table.get("cb_header") clt = table.get("Client") Dim vCase as C = "" vCase = tbl.caseno dim shared c_name as C c_name = upper(trim(clt.fname)+" "+trim(clt.lname)) 'set up prefix for new notes re=ui_msg_box(c_name,"Edit "+c_name+"'s Notes?",UI_QUESTION_SYMBOL+UI_SECOND_BUTTON_DEFAULT+UI_YES_NO) if re = UI_YES_SELECTED 'DO IT ELSE ui_msg_box("CANCELLED","AT USER REQUEST") END END IF 'get the user's worker code and emp_id 'dim v_emp_ID as N = 0 'workerbyempid() 'v_emp_id = accesstoemp(aa.bcbss.access) DIM GlOBAL sumnotes as C = "" DIM SHARED varC_result as C ok_button_label = "&OK" cancel_button_label = "&Cancel" varC_result = ui_dlg_box( "Case Notes for Case # "+vCase,<<%dlg% {region} Please Enter Additional Case Notes:; {sp=10}[%mw%.120,20sumnotes]; {endregion}; {line=1,0}; {region} <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL> {endregion}; %dlg%) if varC_result<>"OK" ui_msg_box(agency,"Action cancelled at user request") end end if debugcheck() 'lets do a spell check ans_sp = ui_msg_box(agency,"Do you want to Spell Check your Notes?",35) if ans_sp = 6 sp = A5_SPELLCHECKSTRING(sumnotes,"text") if sp.lastbutton = "cancel" 'do nothing else sumnotes = sp.text end if else UI_MSG_BOX(AGENCY,"Spell Check bypassed at user request") end if 'clear out p_text p_text = "" 'get previous notes and add new notes to them p_text=tbl.Notes tbl.change_begin() tbl.Notes = "*** Case Notes - "+ut(tbl.caseno)+" *** "+c_name+" *** "+ date() + ": " +" ("+wcode+" - " +wname +")" +crlf()+alltrim(sumnotes)+crlf()+"************"+crlf()+p_text tbl.change_end(.t.) delete sumnotes delete p_text delete vCase parentform.Refresh_Layout()
Tom
Comment