Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Problem deleting records

Problem deleting records

Discuss OrbForms Designer and PocketC Architect

Postby sgibson on Tue Oct 15, 2002 7:31 pm

Hey guys! My first post here after buying the software (which so far I love!)

Anyway, I'm having trouble getting Database.removerec() to work as expected so I'm hoping someone may be able to shed some light.

I've added a Delete button to my main form (in addition to the Prev, Next, New buttons) and I've modified the RecordMgr.oc source file that came with the Survey project sample. I added the functions listed below (which are properly declared in the RecordManager object in the app source file). The Delete button calls recMgr.del().

Everything compiles properly and it does delete records. The problem I'm having is that the record data that I want to delete remains visible on the current form (and the other forms that aren't visible as well). The record count gets decremented properly, but it appears to be overwritting the previous record with the actual record I want to delete! However, if I am on the 1st record (iRecord = 0) then it deletes the following record, leaving the current data intact.

It seems this should be a no-brainer, but I've been puzzling over this for some time now and can't get around the problem. Is there something I'm missing?

<pre id="code"><font face="courier" size="2" id="code">
void RecordManager.del() {
// delete current record
deleteRecord();
updateDisplay();
}


void RecordManager.deleteRecord() {
Database db;
DBRecord rec;
int dRec;

dRec = appPrefs.iRecord;
// don't allow deleting the only record!
if (nRecords == 1) {
alert("You can't delete the last record!");
return;
}
// open database
if (db.open("MyData", false)) {
if (confirm("Are you sure you want to delete this record?")) {
// try to remove the record.
db.removerec(dRec);
nRecords = db.nrecs;
if (appPrefs.iRecord > 0) {
appPrefs.iRecord--;
}
}
db.close();

}
}</font id="code"></pre id="code">


Thanks,
Steve


perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
-Steve
sgibson
 
Posts: 24
Joined: Mon Oct 14, 2002 3:18 pm
Location: USA

Postby sgibson on Wed Oct 16, 2002 1:35 am

Well, I figured it out. In case anyone is interested or runs into the same problem...
I needed to read in the new current record index (appPrefs.iRecord) from the database after deleting. So I only had to add one line:

<pre id="code"><font face="courier" size="2" id="code">
void RecordManager.del() {
// delete current record
deleteRecord();
readRecord();
updateDisplay();
}</font id="code"></pre id="code">

-Steve


perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
-Steve
sgibson
 
Posts: 24
Joined: Mon Oct 14, 2002 3:18 pm
Location: USA


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 2 guests

cron