Search code examples
foxprovisual-foxpro

Reading a FPT File


I would like to read a FPT/DBF file I have tried to load the file with any of these

  • FoxPro 7
  • FoxPro 8
  • FoxPro 9

when I edit the FPT I see text in the file I want to change but when I browse the file(FPT) in FoxPro it doesn't show the values I want to change but just gibberish shows in the table columns. It is reading the different columns but the data I am looking for is not there. Any ideas at all would be helpful thanks!


Solution

  • If you are using VFP directly, you should just be able to

    USE YourTable
    browse normal
    

    Then, scroll left/right until you find a column that shows "Memo" instead of actual content. This field is what has the actual content behind the FPT file. If you double click it, it will bring up the content.

    If you are looking for specific text within the memo, you can do

    browse normal for atc( "looking for", WithinWhatColumn ) > 0
    

    This will show you any records that have the content in question. You can then open each one and modify all you want. If you want to do some BULK replacing, you can do that too, such as

    replace WithinWhatColumn with strtran( WithinWhatColumn, "looking for", "change to this" );
       for atc( "looking for", WithinWhatColumn ) > 0
    

    EDIT per feedback

    No problem on the .CDX. VFP keeps files in "sets" when applicable (.DBF, .CDX, .FPT). .CDX files contain the indexes directly associated to a single table, so when the table is opened, so too are the corresponding indexes. If a file has one or more MEMO fileds, then the corresponding .FPT file is created too for the variable length "memo" content.

    In addition, the building blocks within VFP are also DBF-driven, just file name suffix changed... including

    Forms:  (.scx/.sct)  corresponds to .dbf/.fpt
    Visual Class Libraries:  (.vcx/.vct)
    Reports: (.frx/.frt)
    Projects: (.pjx/.pjt)
    

    You can actually use any of these with the explicit suffix corresponding to the dbf portion and look at what it has inside.

    use YourForm.scx browse it has a record for every control on a given form, where it was derived, its properties, base class association, method code, etc..