How to Revert .SCX/.FRX Files to Pre-Transported State in FPW

ID: Q126014

2.60a WINDOWS

The information in this article applies to:

SUMMARY

When you open a report or screen for editing and that report or screen was created on a platform other than the current one, the Transport program is invoked to add platform specific records to .SCX and .FRX files. Once the platform-specific records have been created and the file modified, there is no intrinsic method to revert back to the original (untransported) form. This article shows by example how to do it using code.

MORE INFORMATION

IMPORTANT NOTE: The techniques described below will *PERMANENTLY* remove all work done under the current platform on the file selected. This measure should only be carried out if attempting to repair the work would be costlier in time and effort than starting over again.

Returning the file to a pre-transported state can be accomplished by opening the .SCX or .FRX with the USE command and deleting the records for the specific platform. However, if there are more than a few files to revert, this method can be time-consuming and cumbersome.

The following program will quickly modify the selected files, while allowing control over the name and type of files selected. If the file has no platform specific records, the system message window will show that the selected file has completed processing, with no error generated.

To display an optional safety message prior to packing the database, remove the asterisks placed in front of the section of code.

   * REVERTER.PRG Removes records of the current platform in SCX or FRX
   *
   * This program assumes a clean environment, so any setup code should go
   * here to preserve open files, status settings, and so on.

   SET MESSAGE TO "Click CANCEL when finished"
   SET TALK OFF
   * Loop through SCX/FRX files to be processed, until CANCEL is pressed:

   DO WHILE LASTKEY() <> 27

       fyl = ( GETFILE( 'SCX;FRX', 'Select a file:', 'Revert' ) )

       * CANCEL button pressed, so exit loop:
       IF !FILE( fyl )
           SET MESSAGE TO ""
           RETURN

       * otherwise, valid SCX/FRX file selected:
       ELSE

           DO CASE   && determine current platform
           CASE AT( "WINDOWS", UPPER( VERSION() ) ) <> 0
               vers = "WINDOWS"
           CASE AT( "MAC", UPPER( VERSION() ) ) <> 0
               vers = "MAC"
           CASE AT( "UNIX", UPPER( VERSION() ) ) <> 0
               vers = "UNIX"
           CASE AT( "FOXPRO", UPPER( VERSION() ) ) <> 0
               vers = "DOS"
           OTHERWISE
               WAIT WINDOW "Unknown platform" NOWAIT
               RETURN
           ENDCASE

           USE ( fyl ) EXCLUSIVE  && must not be in use elsewhere!

           DELETE FOR platform = vers   && marks this platform's records

           *** optional warning message:
           * WAIT WINDOW CHR(13)+"   DELETE RECORDS FOREVER?   "+ ;
           *  CHR(13)+CHR(13)+"               [ Y ]es  or  [ N ]o"+ ;
           *  CHR(13) TO answer
           * IF UPPER(answer)<>"Y"
           *     WAIT WINDOW (fyl) + " skipped." NOWAIT
           *     LOOP   && go back for next file
           * ENDIF

           PACK   && permanently remove records

           * Inform user of progress:
           WAIT WINDOW (fyl) + " completed." NOWAIT

       ENDIF   && end of test for valid filename

   ENDDO   && get next SCX/FRX, or cancel

   SET MESSAGE TO ""    && reset status bar

   *  End of Program

Additional reference words: FoxWin 2.60a undo version redo revert KBCategory: KBSubcategory: FxtoolSbuilder
Keywords          : kbcode FxtoolSbuilder 
Version           : 2.60a
Platform          : WINDOWS

Last Reviewed: May 22, 1998