dbTalk Databases Forums  

Why doesn't this work

comp.databases.paradox comp.databases.paradox


Discuss Why doesn't this work in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Craig
 
Posts: n/a

Default Why doesn't this work - 01-29-2007 , 12:03 PM






P10 WinXP
An indexed table with 3 fields. The 3rd field is a checkbox field which has
a "Y" when checked.
The table is presented as a tableframe on a form/
The user clicks on the fields he wants included. I need to count the # of
records to be used

siCount = 0;// set counter
TC2.edit()
If not TC2.lockRecord() then
errorshow()
ENDIF
If not TC2.postrecord() then
errorshow("Could not post TC2 record")
return
ENDIF


Scan TC2 for TC2."Checkbox" = "Y":
msginfo(TC2."ClinicalCode",TC2."CheckBox")
siCount = siCount +1
ENDSCAN

The reason for the lockrecord is because it wouldn't postrecord() because
the record was not locked.
It always skips the last checkbox. Why?

Thanks in advance

Craig



Reply With Quote
  #2  
Old   
Ed Nash
 
Posts: n/a

Default Re: Why doesn't this work - 01-29-2007 , 12:30 PM






Craig wrote:
Quote:
Scan TC2 for TC2."Checkbox" = "Y":
msginfo(TC2."ClinicalCode",TC2."CheckBox")
siCount = siCount +1
ENDSCAN

The reason for the lockrecord is because it wouldn't postrecord() because
the record was not locked.
It always skips the last checkbox. Why?

Thanks in advance

Craig



Have you tried doing a query instead? It may be just as fast, or
faster, than a scan for this. Or, you could put a secondary index on
CheckBox, then do a setRange(), then tc.nRecords().


Reply With Quote
  #3  
Old   
Bertil Isberg
 
Posts: n/a

Default Re: Why doesn't this work - 01-29-2007 , 01:14 PM



Craig

Where is tc2 opened or attached?

If you have attach tc2 to a uiobject in your form, a tc2.postrecord() or
tc2.unlockrecord() won't post/unlock the editing made in the form. That
record will still be locked. You have to unlock the record used in your
form. And that cant be done with the tcursor.


--
Bertil Isberg - CTECH
Paradox buglist:
online: http://hem.bredband.net/bertilisberg/

"Craig" <craig.futterman (AT) nospam (DOT) comcast.net> skrev i meddelandet
news:45be36d9$1 (AT) pnews (DOT) thedbcommunity.com...
Quote:
P10 WinXP
An indexed table with 3 fields. The 3rd field is a checkbox field which
has
a "Y" when checked.
The table is presented as a tableframe on a form/
The user clicks on the fields he wants included. I need to count the # of
records to be used

siCount = 0;// set counter
TC2.edit()
If not TC2.lockRecord() then
errorshow()
ENDIF
If not TC2.postrecord() then
errorshow("Could not post TC2 record")
return
ENDIF


Scan TC2 for TC2."Checkbox" = "Y":
msginfo(TC2."ClinicalCode",TC2."CheckBox")
siCount = siCount +1
ENDSCAN

The reason for the lockrecord is because it wouldn't postrecord() because
the record was not locked.
It always skips the last checkbox. Why?

Thanks in advance

Craig





Reply With Quote
  #4  
Old   
Craig
 
Posts: n/a

Default Re: Why doesn't this work - 01-29-2007 , 01:26 PM



Bertil,
Yes, you are correct (yet again....)
I opened the TCursor (TC2) when the form opened.
I changed it to UI.postrecord and it worked beautifully!!!

Thanks,
Craig Futterman

"Bertil Isberg" <ctech (AT) corel (DOT) ca> wrote

Quote:
Craig

Where is tc2 opened or attached?

If you have attach tc2 to a uiobject in your form, a tc2.postrecord() or
tc2.unlockrecord() won't post/unlock the editing made in the form. That
record will still be locked. You have to unlock the record used in your
form. And that cant be done with the tcursor.


--
Bertil Isberg - CTECH
Paradox buglist:
online: http://hem.bredband.net/bertilisberg/

"Craig" <craig.futterman (AT) nospam (DOT) comcast.net> skrev i meddelandet
news:45be36d9$1 (AT) pnews (DOT) thedbcommunity.com...



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.