Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SDT - Can't Change Field Type from AutoInc
Message
From
07/08/2003 14:45:52
 
 
To
07/08/2003 10:53:34
Steven Herbin
SNH Computing Corporation
Swan Lake, New York, United States
General information
Forum:
Visual FoxPro
Category:
Stonefield
Miscellaneous
Thread ID:
00817357
Message ID:
00817914
Views:
15
Hi Steve.

>This is kind of on the same subject. When I create a field which will be used as an autoincrementing key and put it in the Field Repository as such, I can't use it as a foreign key in a child table. ... because when I bring it into the child table from the field repository, it comes in with an field type of autoincrementing and you really can't change the field type since it changes right back if you update the tables. Is this just a chicken or egg situation or is there a workaround?

We were being a little aggressive in determining whether a field was auto-incrementing or not (it isn't a new data type, it's an Integer field with the step value set to something other than 0). Here's the fix: in the AnyChange method of the cboType combobox on page 1 of TD.SCX, change the code to:
local lcValue, ;
  lcType
lcValue = This.Value
do case
  case lcValue = 'Character'
    replace NDECIMALS with 0
    lcType = 'C'
  case lcValue = 'Currency'
    replace NSIZE with 8, NDECIMALS with 4
    lcType = 'Y'
  case lcValue = 'Numeric' or lcValue = 'Float'
    lcType = iif(lcValue = 'Numeric', 'N', 'F')
  case lcValue = 'Date' or lcValue = 'DateTime'
    replace NSIZE with 8, NDECIMALS with 0
    lcType = iif(lcValue = 'Date', 'D', 'T')
  case lcValue = 'Double'
    replace NSIZE with 8
    lcType = 'B'
  case lcValue = 'Integer'
    replace NSIZE with 4, NDECIMALS with 0
    lcType = 'I'
  case lcValue = 'Logical'
    replace NSIZE with 1, NDECIMALS with 0
    lcType = 'L'
  case lcValue = 'Memo'
    replace NSIZE with 4, NDECIMALS with 0
    lcType = 'M'
  case lcValue = 'General'
    replace NSIZE with 4, NDECIMALS with 0
    lcType = 'G'
endcase
replace LBINARY with 'Binary' $ lcValue or ;
  trim(lcValue) $ 'Currency,Integer,Double,DateTime'
if 'Auto' $ lcValue and not empty(XDEFAULT)
  replace XDEFAULT with ''
endif 'Auto' $ lcValue ...
do case
  case 'Auto' $ lcValue and NSTEPVALUE = 0
    replace NSTEPVALUE with 1
  case not 'Auto' $ lcValue and NSTEPVALUE <> 0
    replace NSTEPVALUE with 0
endcase
with This.Parent
  .spnWidth.Refresh()
  .spnDecimals.Refresh()
  .txtDefault.Refresh()
  .spnStepValue.Refresh()
  .spnNextValue.Refresh()
endwith
Thisform.HandleType(lcValue)
Doug
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform