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

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

Recommended Posts

Posted (edited)

I'm a newbie at Filemaker, but oldtime computer user. I want to automate some data entry. I want to have a script do the import. The Filename to be imported has to become a field in the table the file is imported to. For example

Filename = FOO

with records

aaa bbb ccc

ddd eee fff

when the import is done I want to have four fields with

aaa bbb ccc FOO

ddd eee fff FOO

I've been looking at the various functions and scripting commands, but can't figure out which to use.

Can someone please point me in the right direction? Thanks in advance.

Edited by Guest
Posted

If you can use a little AppleScript in a FileMaker 8 script:

Perform AppleScript step:

set theFile to (choose file)

set cell "_gFile" to theFile as string

tell application "Finder"

set theName to name of theFile

end tell

set cell "_gFileName" to theName

Then, set a Script Variable, $FileToImport (or whatever) to:

"filemac:/" & Substitute ( Data::(_gFile; ":"; "/" )

Then Import, with $FileToImport as the path, with [x] Allow auto-enter calculations

The field FileName can auto-enter _gFileName

Import_wFilename.zip

Posted

Eureka! I've done it, I can now import the filename into a table along with the data in the file and all in Filemaker.

------------

The Problem:

-----------

I have a folder with multiple files. The data in each file is similar

(this is for a pottery business. Each file represents a kiln firing and each line in the file has the name and dimensions of each piece in the kiln)

All the lines in each file have to become rows in just one table and then need to contain the name of the file it came from.

example

FIRING FOLDER

SKUTT_20060105 (file 1)

Sue 2 4 5 (line 1)

Sue 3 2 3 (line 2)

Paul 2 5 5 (line 3)

Paul 3 9 9 (line 4)

Karen 7 8 8 (line 5)

BAILEY_20060106 (file 2)

Sue 12 4 5 (line 1)

Paul 2 6 6 (line 2)

Paul 13 9 9 (line 3)

SKUTT_20060109 (file 3)

Sue 2 14 5 (line 1)

Sue 3 2 13 (line 2)

Karen 17 8 8 (line 3)

End result needs to look like this:

Filemaker table

+--------------------------------------------------+

+ Name + Height + Width + Depth + Filename +

+--------------------------------------------------+

+ Sue + 2 + 4 + 5 + SKUTT_20060105 +

+ Sue + 3 + 2 + 3 + SKUTT_20060105 +

+ Paul + 2 + 5 + 5 + SKUTT_20060105 +

+ Paul + 3 + 9 + 9 + SKUTT_20060105 +

+ Karen + 7 + 8 + 8 + SKUTT_20060105 +

+ Sue + 12 + 4 + 5 + BAILEY_20060106 +

+ Paul + 2 + 6 + 6 + BAILEY_20060106 +

+ Paul + 13 + 9 + 9 + BAILEY_20060106 +

+ Sue + 2 + 14 + 5 + SKUTT_20060109 +

+ Sue + 3 + 2 + 13 + SKUTT_20060109 +

+ Karen + 17 + 8 + 8 + SKUTT_20060109 +

+--------------------------------------------------+

---------

Solution:

---------

1) Define a table to hold the file names temporarily

File Names temp

Field Name Field Tpe Formula/ Entry Option

-----------------------------------------------------

Text Coontains Text

File Name Text

File Path Text

2) Create your data table

Firing Slips

Field Name Field Tpe Formula/ Entry Option

----------------------------------------------------------

Name Text

Height Number

Width Number

Depth Number

Filename Calculation (Text) = $file

3) create a Script to get the filenames:

GET FILE NAMES

--------------

Go to Layout ["File Names temp" (File Names temp)]

Import Records [Folder Name: Your data folder name here; File Type: Picture and movie files; Import only a reference; Target: "File Names temp"; Method: Add; Character Set: "Mac Roman"; Field Mapping:

Source field 2 import to File Names temp::File Name

Source field 3 import to File Names temp::File Path]

[No dialog; Data contains column names]

Show All Records

4) Create a script to do the import

IMPORT DATA

-----------

Go to Layout ["File Names temp" (File Names temp)]

Go to Record/Request/Page

Loop

Set Variable [$path; Value:File Names temp::File Path]

Set Variable [$file; Value:File Names temp::File Name]

Set Variable [$PathToFile; Value:Right ( $path ; Length ( $path ) -6)]

Import Records [No dialog: "$PathToFile"; Add; Mac Roman]

Go to Record/Request/Page [Next; Exit after last]

End Loop

Show All Records

Exit Script []

5) Create a script to cleanup the temp table

CLEAN UP FILE NAMES

------------------

Go to Layout ["File Names temp" (File Names temp)]

Show All records

Delete All records {No dialog]

That's it Have fun with it.

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