Thatâs a good question. I think itâs something that you would probably want to write a template to do.
From your normal Clarion program you donât have any information about the field/column that caused the problem. Clarion just knows it expected one record to be updated and the server tells it that it found 0 records to update.
The information about what is in the file/views buffers that the WATCH statement stores is maintained by the file driver, and not accessible to you, the programmer. The WATCH is armed in the BrowseClass.UpdateViewRecord.
If you wanted to figure out the column causing the problem, I think what you would have to do would be:
Write your own version of the Watch statement that stores the file buffers â note that the Watch is followed by a reget, and the help for that says:
REGET re-loads all the VIEW component filesâ record buffers with complete records. It does not perform the relational âProjectâ operation.
Youâd presumably call your version of the watch before the parent call of the browseclass.updateviewrecord.
When the update fails, which is in FileManager.UpdateServer (the OF RecordChangedErr branch), you would want to call your diagnostic routine. That routine would probably loop though the fields one at a time, and construct a gradually expanding select statement, submitting each one until the server tells you it canât find the record. In pseudocode, something like:
stmnt = âselect count(*) from where 1=1â
for field in file
stmt = stmnt & âand â & field â = â <storedfield_value>â
count_return{PROP:SQL} = stmt
if count_return:recs = 0
return 'The problem field was â & field
end
end ! loop
So, as I mentioned, probably template territory, because you donât want to be writing that code by hand. Beyond my talents, but probably not really that hard. You want to keep adding the columns because a select on each column alone might return a record, but with all the columns combined, it doesnât.