Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Importing multiple data sets


Mark Hardee

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

Recommended Posts

FMPro9 . daily reports from a online storefront are emailed to me each morning. File sent is a .csv file and imported into Filemaker for manipulation and reports. Import script is simple clear out old records and pause while you navigate to folder to select the "file of the day"

On Mondays, there are multiple orders waiting for FRIDAY THROUGH SUNDAY IN SEPARATE FILES. When the import script is paused for naviagtion to the file, I can not for the life of me figure out how to add more than 1 file.. Import is not selectable when it is called from the script and paused..

What am I missing? Some sort of loop section in the script?

Not a real biggie, but, an annoyance...

Mark

Link to comment
Share on other sites

Times like this is when I turn to a plugin like FileManipulator so you can scan a directory for "all" files in that directory, and return a list of these files, you then could test to see if they are all .csv files and weed out others, Then step thru a process to import each file.

Basically you are not "choosing" the individual file but only the folder you wish to process.

Thus eliminating a pause...

However you could call your script again?

Hit button to perform script

dialog : do you want to import a file? yes/no

if yes

import step (choose file)

perform script import file

if no

halt

end if

this way you are not "pausing your script"

Link to comment
Share on other sites

If this is all on Macs, there is a simple AppleScript command, list folder, which returns the names of the files (which you can then recombine with the folder path to get the full path). Alternatively you can use "files of folder", like this:

set theFolder to choose folder

-- or pass the folder path from a FileMaker field, or hard-code it (Mac format)



tell application "Finder"

	set files_txt to (files of theFolder whose name extension is "csv") as Unicode text

end tell



-- You would then need to set these into a FileMaker (global?) field:



set cell "_gFiles" of table "TO name" to files_txt

Then you'd loop through the global field, translate the path into a FileMaker-syntax path (add "filemac:" prefix, substitute "/" for ":"), set that into a script Variable, then import using the Variable as the file path.

[P.S. You'll need to Add a real file path into the Import dialog also, in order to set up or see the Import Order. The dialog accepts return-separated paths. It will check them in the order entered. So like this, with the Variable ($filepath) first:

$filepath

filemac:Macintosh HD:Users:You:Documents:Some file.csv

Edited by Guest
Link to comment
Share on other sites

However you could call your script again?

Hit button to perform script

dialog : do you want to import a file? yes/no

if yes

import step (choose file)

perform script import file

if no

halt

end if

this way you are not "pausing your script"

This is what I was looking to do..

Have been whacking on it this morning and have it functioning somewhat, but..

I have it pausing to add the multiple files (one at a time) but somehow I am getting into a endless loop..

Start of script Navigates to proper layout

Clears old data and goes to import dialog box..

The IMPORT steps SHOULD BE..

Dialog Box (MULTIPLE FILES)YES OR NO

IF YES, IMPORT First file

Back to dialog box...

Loop until I click NO

End step and continue with script

Script continues on to sort, print and export data

Have all working BUT the "IMPORT STEPS" above..

Sigh....

Edited by Guest
Link to comment
Share on other sites

This topic is 6237 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.