Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changerecord/Deleterecord

Status
Not open for further replies.

olemf

Programmer
Jan 26, 2006
5
NO
Hi!

I'm new to Clarion, and are trying to make a solution of deleting and changing records. I can manage to insert new records, but when I try to delete it or change it, then I get an error: Record not available(33). As I said, I'm new to this so I hope there is an easy solution to this problem... (Some code examples would be great)

Thanks, Ole
 
Ole,

If you can post your code maybe we can suggest the corrections.

Clarion works with data files with a data buffer i.e. record area. So, to edit the record you need to first fetch/get the record and then change the values in the record buffer and then update/put the record. Similarily to delete, you need to fetch/get the record and then delete it.

Regards
 
ShankarJ,

Thanks for your reply, I'll explain some more about my app.
I'm having a List (Browse) where I have a List of items selected from my file (table). When I want to change an item in the list, the list call up a Listfrm (Form) where the change is done. The the Listfrmcode where I get the failure is:

OF ChangeRecord
LOOP
LocalResponse = RequestCancelled
SETCURSOR(Cursor:Wait)
RecordChanged=false
IF (SAV::SKIP:Record <> SKIP:Record)
RecordChanged = True
END
!***********************************************
IF RecordChanged THEN
Update::Error = RIUpdate:QSSKIP(1)
ELSE
Update::Error = 0
END
SETCURSOR()
!***********************************************
IF Update::Error THEN
IF Update::Error = 1 THEN
CASE StandardWarning(Warn:UpdateError)
OF Button:Yes
CYCLE
OF Button:No
POST(Event:CloseWindow)
BREAK
END
END
DISPLAY
SELECT(?OK)
ELSE
IF RecordChanged OR VCRRequest = VCRNone THEN
LocalResponse = RequestCompleted
END
POST(Event:CloseWindow)
END
BREAK
END
END

I dont know what triggers the errormessage I posted in my first posting, but it happens in the section I marked in my code. I was thinkin maybe the errorbox is made from the database? Dont know... I also get the StandardWarning, so Update::Error = 1.

The code in List (Browse) is using a DO BRW1:CallUpdate where the Listfrm is called. This work fine, as I the item I chose is posted in my textarea in Listfrm (Form).

Thanks, Ole
 
I think maybe my problem is that I dont fetch/get the record. When I click the savebutton in Listfrm, I call SyncWindow, in which I call LookUpRelated. The LookUpRelate routine is supposed to fetch all related records, but contain no code...(?). Maybe this is my problem? How do I solve that?
 
Ole,

You are using Legacy i.e. Clarion Template chain and not ABC and it has been a while since I used Legacy.

Few questions:
1. Are the Primary Key components on the Browse i.e. either displayed or set as Hot Fields?
2. Are the Primary Key components displayed on the Form (can be hidden also)?

The above is very important as it makes sure that the primary key components are available for a get or a reget.

Normally when you press the SAVE button, it posts a EVENT:Accepted to all the controls to enable the control validations to take place. This is called the ACCEPTALL loop. Secondary files will not be fetched in an ACCEPTALL loop as it will degrade performance.

Since you are using the standarr FORM & BROWSE templates, make sure that you are not explicitly trying to fetch the record being edited also as it is done by the template generated code anyway.

Regards

 
ShankarJ,

First of all, all my code is generated. I havent made a single line of code except messages to try to see where I am in the code while running my app (my way to debug for now...). To answer your questions:

1. Dont think so... I opened browse box behavior->Hot fields and nothing was set. So I set it to my primarykey. So if thats right, done. Should I check 'bind fields'?

2. Ehhh, dont actually know what you mean, but as I select an item in my list (The list is a list of my primary keys), click edit (this is in List (Browse)) then a new form popup (Listfrm (Form)), containing the primary key in title and in the textarea where I change the value. If I dont change the value, then it seems to work fine (but whats the point of editing whitout changing value...) but when I change value, I get the failure. I've set record identifier to !SKIP:ID and checked the display on titlebar. (messages and titles)

If I click delete, the Listfrm dont popup, I just get the failuremessage.

The error contain a probably cause: QSSKIP

I ran the app after making hotfields, but still wont work.

Thanks, Ole

 
Ole,

Most important questions that I had missed asking:

What version of Clarion and which Database Driver are you using?

Regards
 
ShankarJ,

Been away for a while, so sorry for late answer.
I'm using Clarion 6.2, and using MS-SQL as database. The drivers in my registry is c60xxx.dll.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top