Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: onytoo
  Where is onytoo?
 Padang
 Indonesia
 onytoo
 To: dan delpuerto
  
 
 
 dan delpuerto
 Tags
Subject: RE: addproperty
Thread ID: 344838 Message ID: 345142 # Views: 31 # Ratings: 0
Version: Visual FoxPro 6 Category: Classes and Objects
Date: Friday, May 18, 2012 9:32:00 PM         
   


> Thanks.
> I am developing a sort of a DBF class/driver that can create more than 255 columns and more than 255-char field width (but still less than 2GB data and cannot be SQLed) - w/c I have successfully tested. However, I need to clear the created fields of the instance of the class/driver to open another file.
> Example:
> o = createobject("DbfClassDriver")
> o.Use("file1")
> o.Use("file2") - now consists of file1 and file2 fieldnames
>
> Or else I have to create a dedicated instance for file2


How about this:
you can create an object at runtime that filled with all fields name in selected table/cursor
using SCATTER NAME object_name [ BLANK ]

This is not perfect that I'm sure, but maybe can give a clue

*!* DbfClassDriver.CreateFieldObject
LPARAMETERS tlBlank
IF !PEMSTATUS(this, "Fields", 5)
  this.AddProperty("Fields", .NULL.)
ENDIF
IF m.tlBlank
  SCATTER NAME this.Fields BLANK
ELSE
  SCATTER NAME this.Fields
ENDIF

*!* this is example how to call it
*!*
*!* DbfClassDriver.Go
LPARAMETERS tcWhere
tcWhere = UPPER(m.tcWhere)
DO CASE
CASE m.tcWhere == "TOP"
  GO TOP
CASE m.tcWhere == "PREV"
  IF !BOF()
    SKIP -1
  ENDIF
  IF BOF()
    GO TOP
  ENDIF
CASE m.tcWhere == "NEXT"
  IF !EOF()
    SKIP
  ENDIF
  IF EOF()
    GO BOTTOM
  ENDIF
CASE m.tcWhere == "BOTTOM"
  GO BOTTOM
ENDCASE
this.CreateFieldObject()

*!* DbfClassDriver.Use
LPARAMETERS tcTable
*!* write your code here to open table
this.Go("TOP")


*!* this is example how to use it
oData = CREATEOBJECT("DbfClassDriver")
oData.Use("Customer")
? oData.Fields.cust_name
*!* So if you don't need fields structure anymore
*!* then you can simply assign a null value to it.
oData.Fields = .NULL.





Regards,
Onytoo

ENTIRE THREAD

addproperty Posted by dan delpuerto @ 5/14/2012 5:14:06 PM
RE: addproperty Posted by Borislav Borissov @ 5/14/2012 5:15:43 PM
RE: addproperty Posted by dan delpuerto @ 5/14/2012 5:28:49 PM
RE: addproperty Posted by Borislav Borissov @ 5/14/2012 6:14:12 PM
RE: addproperty Posted by dan delpuerto @ 5/14/2012 6:22:39 PM
RE: addproperty Posted by Pete Sass @ 5/14/2012 6:29:38 PM
RE: addproperty Posted by dan delpuerto @ 5/14/2012 6:38:42 PM
RE: addproperty Posted by Pete Sass @ 5/14/2012 10:57:26 PM
RE: addproperty Posted by dan delpuerto @ 5/15/2012 3:34:54 AM
RE: addproperty Posted by Tamar Granor @ 5/14/2012 10:47:36 PM
RE: addproperty Posted by Gordon King @ 5/15/2012 1:02:58 AM
RE: addproperty Posted by dan delpuerto @ 5/15/2012 3:51:44 AM
RE: addproperty Posted by Gordon King @ 5/15/2012 4:07:17 AM
RE: addproperty Posted by Jijo Pappachan @ 5/17/2012 8:20:40 AM
RE: addproperty Posted by dan delpuerto @ 5/17/2012 3:07:26 PM
RE: addproperty Posted by onytoo @ 5/18/2012 9:32:00 PM
RE: addproperty Posted by dan delpuerto @ 5/19/2012 9:26:11 AM