9 Replies Latest reply on Dec 4, 2014 5:11 PM by Stephen Huston

    Export part of a larger Dbase into a new standalone file?

    ninja

      I think I'm overthinking this and need to be pulled back to reality...

       

      I have a solution running a manufacturing operation (~40 tables or so across different operations)

       

      I need to snap-shot some of the data and compare it to a month ago for tracking performance.

       

      This snapshot need only be two of the existing tables...and historically we've been just working from copies of the daily backups including the whole dbase.

       

      Now the Dbase size is ~120MB and it is becoming a pain to move it around the world via cloud....it just takes too long to upload and download.

       

      Only ~3MB is pertinent to what we are trying to do, so I'm looking for a simple way to script the export of those two tables and create a two-table dbase that we actually care about for the snap-shot.

       

      If I build the two-table dbase and export into it, no problem.

      But is there a way to simply create the two table dbase via this script?

      {Export "this" section of the dbase to a new file sort of thing?}

       

      If not, I'll simply clone one of the other dbases, strip out the other tables and run the import/export from there.

       

      Thanks for your input!

      Eric T.

        • 1. Re: Export part of a larger Dbase into a new standalone file?
          Stephen Huston

          You can use the Export Record script step to save the current table/fields/record-data to another FMP12 file directly, by specifying the full export options, fileName, fields to include, etc, after identifying the found set you need for that "snapshot."

           

          Then you've got your raw FM data and field structure from any moment you choose to run that script, and you could either import it into another table, or, using the separation model, use it as a data source when viewing your snapshot interface file.

          • 2. Re: Export part of a larger Dbase into a new standalone file?
            ninja

            Thanks Stephen.  That part I knew (but always good to hear anyway).

             

            Its the part of " to another FMP12 file directly" part I'm wondering if it is possible to avoid.

             

            Can it be done if the target file is not in existence yet?  Sort of a "Save As" function?

             

            I'm guessing not, but wanted to check with y'all who know much more than I about what's possible.

             

            Thanks!

            • 3. Re: Export part of a larger Dbase into a new standalone file?
              mikebeargie

              if the target does not exist, then you can only save a single table at a time.

               

              What you might want to do is store a .fmp12 "template" in a container field, export the container contents with a new name, then use that new name to export the contents from your two tables into that single file.

               

              This way you can get as creative as you want with that template file, and not be confined to a flat data-only file that the export records script step generates.

              • 4. Re: Export part of a larger Dbase into a new standalone file?
                Stephen Huston

                My idea for using the script step to Export AS an FMP12 file actually creates a new FMP12 file with the table/fields/records in cases where the external target file didn't yet exist.

                Isn't that what you are trying to do?

                 

                Message was edited by: Stephen Huston

                • 5. Re: Export part of a larger Dbase into a new standalone file?
                  ninja

                  Wow...never would have thought of that one.  Very cool Mike, I'll try it.  Thanks!

                  • 6. Re: Export part of a larger Dbase into a new standalone file?
                    ninja

                    Will try that one too (now that I understand what you meant )  Thank you.

                    • 7. Re: Export part of a larger Dbase into a new standalone file?
                      ninja

                      Update and thanks.  Job done.

                       

                      For any of those following after...

                      I created a very scaled down skeleton of the original Dbase having only the tables/layouts/scripts needed for the "snapshot".

                      I created a new table in the existing solution called "monthend" with a container and a text field...a single record, and put the skeleton file in the container.

                       

                      The script goes:

                       

                      Show custom dialog {and traps the users desired filename into the text field}

                      SetVariable ($Filnename ; Value: Get(DesktopPath) & MonthEnd::Textfield & ".fmp12" )

                      Export Field Contents ( MonthEnd::Container ; $Filename ; automatically open)

                       

                      I had built the various import steps into the skeleton file so that it is pulling info from four different tables and performing various necessary lookup functions.

                      Now when it automatically opens, it imports the stuff I need, looks up the stuff I need, and sits ready to use.

                       

                      - Took me a bit to realize I needed the & ".fmp12" on the file path

                      - There's probably an easier way that Stephen was alluding to...but the way I used worked well and fast and I stopped tinkering.

                       

                      Thank you both again.

                      Eric T.

                      • 8. Re: Export part of a larger Dbase into a new standalone file?
                        ninja

                        Furhter update...found a little snag.

                         

                        This system was meant to run on a backup...but it doesn't work on the backup.

                        Since the container field is remote stored (secure), Export Field contents won't work for it.

                         

                        Simple solution:  I run it from the live Dbase instead and all works well.

                        • 9. Re: Export part of a larger Dbase into a new standalone file?
                          Stephen Huston

                          Excellent choice.

                           

                          Trying to incorporate Backup files as part of a live solutions really never works; they're for replacing files or recoving data to restore into a live system. And the file path to the external container data is different in a backup file when trying to open and use it locally.