File Clones and Data
Question: I have a clone file with no data that was created of my main solution, is it possible to import all table date at once. I know the single import table method, File > Import Records > File.
It's one table at a time. We usually use a script for such imports to make sure that we get all data from all tables imported and any fields defined as auto-entered serial numbers updated with appropriate "next serial value" settings.
I unsuccessfully tried using the File > Import Records > File method, while all records were imported certain field data was not.
I found a posted example for "Import Record Script Step" that would import all records from a file and I have a question regarding;
"Set Variable [$file_path; Value:Get(DesktopPath)&"Wandsworth_csv.xlsx"]
This script step sets the local variable with the path to source file, but where is the script run from and what is the best script function to identify the location of the main database file not on the Desktop?
And the path shown is to an Excel file located on the local computer's desktop....
Using just the file name and no path will refer (called a "relative file path") to the same location as the database file. This is not usually a good option for a file currently hosted from a server, but could work for doing an update on a local machine.
You can also set up a system where a dialog opens for selecting the file and once you have selected the file, the series of import records steps import the data from the file initially selected. This method uses an Insert File Script step to insert a reference to the file into a container field and then the file path is extracted from the container field.
** How is the attached script any different from using File > Import Records > File?
How does importing data with script steps ensure all record data is imported?
If I use the attached script I will have to change the "Import Record" step for mapping each table in the database.
More specifically, you will need a different Import Records script for each table. And this is the case whether you use a variable or not. The only exception is the method where you expose the column to field mapping to the user--a not very user friendly option that can lead to major issues with incorrectly imported data if the user doesn't map the columns to fields correctly.
Retrieving data ...