Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DBC Table Templates
Message
From
05/11/1997 16:57:27
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00058192
Message ID:
00058503
Views:
36
>>Let me rephrase this question.
>> I want to use a table already part of the DBC as a
>> template to create monthly files on the fly. I can
>> do this, but I have not been able to maintain long
>> field names or any other useful DBC properties. Any
>> information regarding this would be greatly appreciated.
>>
>>I've posted this question a couple of times. But I was hoping you could help me. Thanks in advance.
>>
>>Dan
>
>It looks like AFIELDS() captures most of the data dictionary information. Field comments, format, input mask, caption, and class and VCX for the intelidrop seem to be the only things missing. Have you tried using AFIELDS() and then a series of DBGETPROPs and DBSETPROPs to copy what's missing?
>
>-Mike


* Program Designed to use a template table and copy all new information to the
* new table.
LOCAL lcNewTable, lnCurrFld, lnTtlFields, lcCaption, lcComment
LOCAL lnTagNo, lnTtlTags, lnCurrTag

* settings
SET SAFETY OFF

* variables
lcNewTable = "LM01101997" && Long table name.

* open template file
OPEN DATA L:\1997\OCT\ACCTRPT
USE L:\1997\OCT\MOEND\LM01 IN 0
lnTtlTags = TAGCOUNT( "LM01" )
lnTtlFields = AFIELDS( aStru, "LM01" )
#IF "VISUAL FOXPRO 05" $ UPPER( VERSION() )
aStru[1,12] = lcNewTable
#ENDIF

* create new file
SELECT 0
CREATE TABLE LM011097 FROM ARRAY aStru
#IF "VISUAL FOXPRO 03" $ UPPER( VERSION() )
RENAME TABLE LM011097 TO (lcNewTable)
#ENDIF

*Loop through all fields to add Database field properties.
FOR lnCurrFld = 1 to lnTtlFields

lcField = aStru[lnCurrFld,1]

lcCaption = DBGETPROP( "LM01." + lcField, "FIELD", "CAPTION")
lcComment = DBGETPROP( "LM01." + lcField, "FIELD", "COMMENT")

=DBSETPROP( "LM01101997." + lcField, "FIELD", "CAPTION", lcCaption )
=DBSETPROP( "LM01101997." + lcField, "FIELD", "COMMENT", lcComment )

ENDFOR

* Loop through all indexes to add all index information.
FOR lnCurrTag = 1 to lnTtlTags
lcFor = FOR( lnCurrTag, "LM01" )
lcKey = KEY( lnCurrTag,"LM01")
IF EMPTY( lcFor )
INDEX ON &lcKey TAG ( TAG( lnCurrTag, "LM01" ) ) OF LM011097
ELSE
INDEX ON &lcKey TAG ( TAG( lnCurrTag, "LM01" ) ) OF LM011097;
FOR &lcFor
ENDIF
ENDFOR

USE IN LM01
USE IN LM011097

* RI must be done separately.
* Any Table Property Triggers must be set manually in VFP 3.0.

SET SAFETY ON


Ok here it is. It has not been sufficiently tested.
Still would like to know how to add RI.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform