Re: Import text file into a field



d-42 <db.porsche@xxxxxxxxx> wrote:

On Sep 12, 12:27 am, Helpful Harry <helpful_ha...@xxxxxxxxxxxxxxxx>
wrote:
In article <1189552805.367487.78...@xxxxxxxxxxxxxxxxxxxxxxxxxxx>, d-42

<db.pors...@xxxxxxxxx> wrote:
Hi,

I need to import a text file into a field for further parsing. All to
be done via a script.

I know I can do this with Import Folder, selecting text files, but is
there a way of doing this by just naming the file?

Importing a folder (and arranging things so that there is only one
file in the folder) seems clumsy.

The Import Records script command allows you to specify a filename ...
but it will have to be the same filename every time the script is run
(or at least in my version the filename is "hard coded" and you can't
use a field to hold filenames).

Er, import records won't let me import an entire text file into a
single field though, will it?

FileMaker 9's Import Records script step will do that, if you specify a
folder. It will import each text file in the specified folder into a new
record, putting the file content in a single field. You can also set
other fields to the name and path of the source file.

This wasn't mentioned as a new feature in version 9, so perhaps you have
it in version 8 as well.

I've leapt from FM7 to 9, but didn't use many new features in 7, so
version 6 is really the last version I was familiar with.

As for specifying a filename, import records (and any other script
step that supports file references, supports variable names in the the
filename, so you can use fields to hold filenames, provided you set
the variable to the name, before importing the record... but that was
never the issue. The issue is to get an entire file into a field...

Ah, that's a useful tip. BTW, script variables are a relatively new
feature - added in FM8, as far as I can tell.

e.g. suppose I were to send event : cmd /c ipconfig /all > c:\temp
\ipconfig.txt
that would cause the command shell to write out the tcp/ip
configuration data to a file. And what I'd like to do is then import
that file into a global field to be parsed for dns entries, for
example. (That is not what I'm working on, but it illustrates the idea
well enough.)

Create a dedicated folder, put the file (or files) in that folder, and
use Import Records (specifying the folder).

Filename must end with .txt. (On the Mac, it can also be any name but
have a filetype of 'TEXT'.)

--
David Empson
dempson@xxxxxxxxxxxxx
.



Relevant Pages

  • Re: Make folder with accompanying shortcut if possible
    ... (Filename can be a filename, ... Traverse Folder / Execute File ... /P user:perm;spec Replace specified user's access rights. ... Wildcard characters can be used to specify more than one file in a command, ...
    (microsoft.public.scripting.vbscript)
  • Re: Import text file into a field
    ... I know I can do this with Import Folder, selecting text files, but is ... The Import Records script command allows you to specify a filename ... ... always looking for more reasons to justify an upgrade. ...
    (comp.databases.filemaker)
  • Re: Import text file into a field
    ... file in the folder) seems clumsy. ... The Import Records script command allows you to specify a filename ... ...
    (comp.databases.filemaker)
  • Re: Import text file into a field
    ... I know I can do this with Import Folder, selecting text files, but is ... The Import Records script command allows you to specify a filename ... ...
    (comp.databases.filemaker)
  • Re: Newbie to sms installer
    ... OK you want to have a script that: ... Copies a file from one place to another folder ... Then SMS reads that file name ... The variable is parsed one filename at a ...
    (microsoft.public.sms.installer)