Subtracting from my record number on a newrec

Discuss OrbForms Designer and PocketC Architect

Postby dlinder on Wed Jan 25, 2006 6:20 pm

I'm feeling pretty stupid here.

My code seemed pretty simple, but didnt' work. I put some alerts in and here's what I saw:

alert("0 " + giSteps); -- displays a value of 10
recSteps.History = chkUSHistory.checked;
alert("1 " + giSteps); -- displays a value of 10
db.newrec(&giSteps,rec);
alert("2 " + giSteps); -- displays a value of 9

I've put code in to save the value and restore it after the record is written, but I don't understand why the value got decremented.

Anyone have any ideas?

(I'm using V3 if that matters)
dlinder
 
Posts: 37
Joined: Sun Oct 30, 2005 9:53 pm
Location: USA

Postby nmc on Wed Jan 25, 2006 9:06 pm

where did you get the initial value for giSteps from?

Looks like your db had 9 rec (0-8) before the newrec() call.
nmc
 
Posts: 197
Joined: Tue May 27, 2003 8:42 pm
Location: Germany

Postby dlinder on Thu Jan 26, 2006 11:28 am

nmc,

I wasn't sure what you meant at first, but it hit me after a bit.

If the value of the integer you pass to the newrec function is greater than the number of records in the database, the integer will be reset to the number of records. If the value you pass is equal to or less than then number of records in the database, it is left alone.

Thanks.
dlinder
 
Posts: 37
Joined: Sun Oct 30, 2005 9:53 pm
Location: USA

Postby nmc on Thu Jan 26, 2006 11:49 am

The number returned is the index of the new created record; you can also pass -1 to newrec() if you want the new record to be appended.
nmc
 
Posts: 197
Joined: Tue May 27, 2003 8:42 pm
Location: Germany


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 3 guests

cron