Updating a record (OpenInsight 32-bit)
At 02 FEB 2012 01:23:47AM Robert Lee wrote:
Is there any special secrets I need to know about updating records? I have created an O4W routine that generates a form in the CREATE event and in the SUBMIT event I attempt to update a record with the following code.
Person.Rec = XLATE('PEOPLE', Person.ID,
, 'X') Person.Rec<10> = Interest.IDs CALL Write_Row('PEOPLE', Person.ID, Person.Rec, 0) Error = Get_Status(ErrCodes) O4WForm() O4WRedirect('/goals/oecgi3.exe/O4W_PEOPLE') I have stepped through this code with DEBUG and Error = 0. When I read the record in the CREATE event of O4W_PEOPLE the record is not updated. Am I doing something wrong or is there a "best practice" method I should follow for updating a record? The code that reads the record is as follows: debug OPEN 'PEOPLE' TO People.File THEN READ Person.Rec from People.file, Person.ID ELSE O4WError('Unable to Read Person: ' : Person.ID) Return END END ELSE O4WError('Unable to Open Person File') Return END </QUOTE> —- === At 02 FEB 2012 02:52AM bshumsky wrote: === <QUOTE> <QUOTE>Is there any special secrets I need to know about updating records? I have created an O4W routine that generates a form in the CREATE event and in the SUBMIT event I attempt to update a record with the following code. Person.Rec = XLATE('PEOPLE', Person.ID,
, 'X')Person.Rec<10> = Interest.IDs
CALL Write_Row('PEOPLE', Person.ID, Person.Rec, 0)
Error = Get_Status(ErrCodes)
O4WForm()
O4WRedirect('/goals/oecgi3.exe/O4W_PEOPLE')
I have stepped through this code with DEBUG and Error = 0.
When I read the record in the CREATE event of O4W_PEOPLE the record is not updated. Am I doing something wrong or is there a "best practice" method I should follow for updating a record? The code that reads the record is as follows:
debug
OPEN 'PEOPLE' TO People.File THEN
READ Person.Rec from People.file, Person.ID ELSEO4WError('Unable to Read Person: ' : Person.ID)ReturnENDEND ELSE
O4WError('Unable to Open Person File')ReturnEND
Hi, Robert. There shouldn't be anything "funny" about writing records in O4W. When you stepped through the code, did you verify that the Person.ID was the correct value, and that Interest.IDs are indeed what you expected them to be? After the XLATE, do you have the correct information to start with?
These are all "regular" (not O4W specific) questions, but I can't see anything write off the bat in your code that would cause an error just in the O4W environment…
- Bryan Shumsky
</QUOTE>
At 02 FEB 2012 03:13AM Robert Lee wrote:
<embarrassed cough>
Wrong field number. It was attempting to overwrite a field that was a relational index.
Need more coffee… I guess you tend to be suspicious with a new system until you've done something a few times. Have I missed something in the manual???
</embarrassed cough>