Jump to content
Server Maintenance This Week. ×

Save Copy as Self-Contained


This topic is 1789 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hey Guys,

 

So we have a runtime solution (windows only at this time) , data and interface in single file (no data separation) and we have just changed all container fields that are accessible to the end users to now use external (open storage).

The issue is when saving a backup i use a script to save a copy of the file as self-contained, when i "reformat" the runtime app to have no records and restore from a backup file via script all data is imported except for the container data. So the container data is not being embedded back into the fields as it should, This bug has been reported since as far back as at least FM14 and has persisted in every FM since including 18. I have tried removing the Full access account and disabling any auto sign in feature in file options, i tried replacing script step "Insert Picture" with "Insert file" with store as reference unchecked. at this time i see no functional use for self contained copies unless i am doing something wrong (as well as many others based on the amount of forum threads on the issue).

If anyways knows what i may do to make this work i'm open to trying out some things, otherwise does anyone know how i can run a backup both the data file and external storage folder together using a script with maybe a batch file or something. To be honest though my level of understanding on using batch files  and the "Send Event" script step is fairly beginner. We have come up with this for a batch script, The file is called Backup.bat and the code is:

cmd /c MD C:\BackupTest
XCOPY C:\"Program Files (x86)"\"My App"\My App.fmp12  C:\BackupTest  /y
XCOPY C:\"Program Files (x86)"\"My App"\"External"\*.*   C:\BackupTest\External\  /s /e /y
REN C:\BackupTest\My App.fmp12   My App.fmp12_%date%

Running this .bat file from the desktop does exactly what we want but would like it to be run automatically in a FM script, Im guessing using the script step "Send Event" is the way to do it but placing the code in Send Event step as text runs, no errors but it actually doesn't backup the files as its supposed to, I tried placing it in the calculation fields but keep getting errors within the calculation due to the added quotes as well as the backslashes, cause backslashes escape quotes and all and I need the quotes used in the code in order for it to work.

I will say that using send event with the File option and targeting the backup.bat file we created works great, does the backup, but the issue is our end users use different backup paths for saving copies and use global fields in a preferences table to determine store these paths, So using the calculation portion of the send even is what we need so we can use this global field in place of the destination path for the .bat file to copy the files to. Has anyone done anything like this? can anyone help me figure out how to modify the above code so its friendly with the filemaker calculation engine and can be dynamic to the users custom path settings, I tried putting the above code into a $$variable and using the $$variable in the calculation field (send event) but that did not work either. I believe if we can get this working it would be a great solution to replace the self contained file issue many seem to have.

 

I have read: https://filemaker.jiveon.com/thread/137765?commentID=472199#comment-472199 and https://filemaker.jiveon.com/thread/167056 and a few others but they did not help.

Link to comment
Share on other sites

Has FMI acknowledged the bug?

Why are you importing as part of a restore? Why not just use the backup file directly?

I'm a little confused as to what is not working.  Are you importing into a file that uses Remote Containers or importing into a file that uses embedded containers?

As to the functional use of "self contained": it's largely around two things:

1) portability; if you want to move a copy of the file to somewhere without having to worry about also moving the RC folder and its content

2) in case you change your mind and want to stop using Remote Containers

 

For your batch file; two ways of solving your issue.

Store the batch file in a container field and do a "export field content" to a known location and then use Send Event to call the batch file

Or, do the full syntax in the Send Event but in that case you have to concatenate every "line" or command together with && so that the Windows command line interpreter will execute each command one after the other.

Link to comment
Share on other sites

  • Newbies
Quote

Has FMI acknowledged the bug?

Yes this issue dates back many versions and has been reported.

Quote

Why are you importing as part of a restore? Why not just use the backup file directly?

I can restore directly from a backup when restoring using the same version of the runtime app, but when a upgraded version of the app is given to the users then a import script is performed grabbing data from over 100 tables in a backup file,  importing into the upgraded version.

Quote

I'm a little confused as to what is not working.  Are you importing into a file that uses Remote Containers or importing into a file that uses embedded containers?

importing from a backup file that uses external containers into a new version is also using all external containers

Quote

 

For your batch file; two ways of solving your issue.

Store the batch file in a container field and do a "export field content" to a known location and then use Send Event to call the batch file

 

Im not sure this option would work since i need to use variable or result from a global field in the database in place of the file paths used in the batch file code.

Quote

Or, do the full syntax in the Send Event but in that case you have to concatenate every "line" or command together with && so that the Windows command line interpreter will execute each command one after the other.

I understand the need to use && between each command, what im having trouble is writing the code in the proper syntax that doesnt mess with the quotation marks and slashes in the batch code file paths so that the end results after the calculation engine comes out like this:

cmd /c MD C:\BackupTest
XCOPY C:\"Program Files (x86)"\"My App"\My App.fmp12  C:\BackupTest  /y
XCOPY C:\"Program Files (x86)"\"My App"\"External"\*.*   C:\BackupTest\External\  /s /e /y
REN C:\BackupTest\My App.fmp12   My App.fmp12_%date%

in the above code C:\BackupTest\ would be replaced with a $$Variable or global field that is edited by the end user to specify the backup path they want to use.

Link to comment
Share on other sites

This topic is 1789 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.