[SOLVED] Maintain problem writing to the dataSource
Hi everyone,
I was wondering if someone could shed some light on a confusing problem I have run into. The following function is supposed to copy all the records from the VOUCHERS table to the VOUCHER_HISTORY table, and then delete all the records in the VOUCHERS table. When I run the function I have verified, by using the debugger, that GetVoucherHistoryStack is populated, but for some reason the records do not write to datasource. The records are deleted from the VOUCHERS table, but nothing is written to VOUCHER_HISTORY table. I have also verified that I can write to the VOUCHER_HISTORY table by hard coding a record and adding it. I've added the code and the corresponding master files below. Maybe someone will see something that I have overlooked.
Thanks allThis message has been edited. Last edited by: brjohnson,
Bryan Johnson WebFOCUS 7.7.03 Maintain Win 7 Excel, PDF, HTML
May 12, 2008, 10:38 PM
Waz
Bryan, acouple of questions
What are the Keys to the history table?
Have you checked the FocError after the include to see if there has been an error?
Also, if there is an error, you should not do the delete as well.
Your process of include and delete should be a logical unit of work, then committed.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
May 13, 2008, 09:27 AM
brjohnson
Hi Waz, Thanks for your reply.
The key to both tables is VCHRID.
I checked the FocError and it is returning -22, and the FocErrorRow is 1. I'm not sure what that means, is there a list of what the various error codes mean because I couldn't find it in the documentation.
ThanksThis message has been edited. Last edited by: brjohnson,
Bryan Johnson WebFOCUS 7.7.03 Maintain Win 7 Excel, PDF, HTML
May 13, 2008, 10:55 AM
brjohnson
Hi,
After more closely inspecting the data it turns out that there were records that had the same VCHRID in both tables. Although this was not supposed to happen(it's tough to write a good application with bad data), I was able to find a workaround. The function works now. I would assume that the focError -22 must have been referring to adding a record that has the same key value as a record already in the table, but it would be helpful to see if IB has a list of possible causes for the various FocError codes. Anyway, thanks for your help Waz.
The people in this forum are the best!
Bryan Johnson WebFOCUS 7.7.03 Maintain Win 7 Excel, PDF, HTML
May 13, 2008, 05:38 PM
Waz
Not knowing your data, I assume that VCHRID will always be unique for the history table. If not you may need a time stamp to keepp it unique.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
May 14, 2008, 11:09 AM
Dave Ayers
quote:
it would be helpful to see if IB has a list of possible causes for the various FocError codes.
I strongly agree with Bryan on this. I have seen many questions arise on this board about the meaning of these error codes without a clear resolution.
It is far past time for IBI to address this issue and give us a list of the FocError code and their meaning , so Maintain coders have a fighting chance of debugging their applications.
It would be adequate to post them here in the WebFocus forum, in lieu of a formal document, at least they would be available to the community.