Path: utzoo!attcan!uunet!amdahl!ames!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!violet.berkeley.edu!steve From: steve@violet.berkeley.edu (Steve Goldfield) Newsgroups: comp.databases Subject: Re: dBASE III+ bug? Message-ID: <21458@agate.BERKELEY.EDU> Date: 11 Mar 89 00:35:07 GMT References: <6056@bsu-cs.UUCP> Sender: usenet@agate.BERKELEY.EDU Distribution: na Organization: University of California, Berkeley Lines: 42 In article <6056@bsu-cs.UUCP> neubauer@bsu-cs.UUCP (Paul Neubauer) writes: #*Here is a question for anyone out there more knowledgeable than I about #*dBASE. I am doing an application involving several tables (.DBF files) #*where the main key for the principal table is the connection to the #*subsidiary tables. Specifically, the main table is a table of service #*requests and there are (several) other tables of, e.g. equipment needed, #*etc. Each of these tables may contain one or more items related to the #*requests table. I determined to use the request key as the relating field #*and I then number the items in a category, e.g., equipment orders, so that #*each item of equipment will have its own number. I then index on #* request_no+str(item_no) #*since the request number is a character string (though all digits) and the #*item_no is a number (I do minimal arithmetic on it, i.e. increment it from #*the preceding one). The problem arises when I add new items to the items #*table. In order to enable default values for several fields, I use #*APPEND BLANK and then REPLACE the default values into those fields. What #*happens then is that the new records are not indexed properly. REINDEXing #*solves that, but I certainly do not want to REINDEX every time I add a #*record. Experimentation has revealed that if I change the item_no field to #*a character field instead of a numeric field the index is maintained #*properly and automatically, but when the index is on a character field #*concatenated with a STR'ed numeric field the index breaks down. I have also #*determined that if I use APPEND instead of APPEND BLANK the indexing works #*properly whichever field types I have. #* #* Has anyone else ever experienced a similar problem? What have you #*done about it? I assume that I can just turn the item_no field into a #*character field and convert it back and forth, but that seems silly. I #*welcome any better suggestions. Thanks. #* #*-- #*Paul Neubauer neubauer@bsu-cs.bsu.edu neubauer@bsu-cs.UUCP #* !{iuvax,pur-ee}!bsu-cs!neubauer Check your manual on this, but I suspect you may be having a problem with STR defaults because you don't specify the length or number of decimal points of your output string, such as STR(item_no,5,0). So if you expect to get all digits, it's possible that there are spaces and periods embedded which interfere with indexing as you intend. Steve Goldfield