f



imported file name

I can't believe that we're at version 7.0 of FileMakerWannaBe, and STILL 
we can't capture the filename of an imported file. Surely I'm missing 
something.

I'm trying to import a file into a table, and need to set one of the 
fields to the name of the imported file. (The name of the imported file 
is already set to the specific string that I need it to be, plus .txt at 
the end.)

I've seen other recommendations regarding 3rd party plug ins, but I'm 
not shelling out yet more money just to handle the most rudimentary 
function that FileMaker can't do.

Obviously, the subgeniuses at FileMaker never read this newsgroup.

Can anyone manage this?

thanks.
0
Bob
11/15/2004 12:56:53 AM
comp.databases.filemaker 10984 articles. 0 followers. amosw01 (46) is leader. Post Follow

14 Replies
663 Views

Similar Articles

[PageSpeed] 3

Bob wrote:
> I can't believe that we're at version 7.0 of FileMakerWannaBe, and STILL 
> we can't capture the filename of an imported file. Surely I'm missing 
> something.

Well, which is it?  Is it that FileMaker 7 can't capture the filename or 
that you are missing something?

Have you tried setting a text field (or a calc) to 
getastext(ContainerField)?

> I'm trying to import a file into a table, and need to set one of the 
> fields to the name of the imported file. (The name of the imported file 
> is already set to the specific string that I need it to be, plus .txt at 
> the end.)

Or if you are importing a folder of files at a time, you will see the 
file name and path as two separate fields that can be imported along 
with the images or other type of files.

> Obviously, the subgeniuses at FileMaker never read this newsgroup.

Actually, that's not true.  I know that over time I have seen a couple 
different FMI engineers post here under their own names.  But more 
often, they post under assumed names to hide their identity.  And 
regardless of whether they post anything or not, I guarantee there is at 
least one FMI employee lurking silently to keep up with issues that are 
out there.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg              (818) 883-2846
FM Pro Solutions       Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance
0
Howard
11/15/2004 2:30:42 AM
> Have you tried setting a text field (or a calc) to 
> getastext(ContainerField)?

what does that mean? there IS no container field... I've seen others 
post the same advice, but what is that supposed to mean? even if I did 
have a container field, I'm importing a file into a series of 
records.... what is that supposed to mean?

 
> > I'm trying to import a file into a table, and need to set one of the 
> > fields to the name of the imported file. (The name of the imported file 
> > is already set to the specific string that I need it to be, plus .txt at 
> > the end.)


batch loading might be an idea, even if its only batch loading a single 
file... I'll look into it.
0
Bob
11/15/2004 3:02:35 AM
> Or if you are importing a folder of files at a time, you will see the 
> file name and path as two separate fields that can be imported along 
> with the images or other type of files.


hm, I tried setting the import script function to act on a folder, and 
it let me set it up that way... but nothing gets imported. any one of 
those files imports just fine, but tring to import the folder does 
nothing.

still screwed, huh?

I'm only using filemaker here to prototype an application... the 
prototype shouldn't be harder to setup than the actual program.

come on, filemaker, implement variables... version 7, and still not a 
variable in sight?

sigh, it's shortcomings like this that have plagued filemaker since 
version 1.
0
Bob
11/15/2004 4:05:11 AM
Bob wrote:
 > come on, filemaker, implement variables... version 7, and still not a
 > variable in sight?
 >
 > sigh, it's shortcomings like this that have plagued filemaker since
 > version 1.

If you would explain to us what on earth you are trying to do, perhaps 
someone could help you.  See answers below...

>>Have you tried setting a text field (or a calc) to 
>>getastext(ContainerField)?
> 
> what does that mean? there IS no container field... I've seen others 
> post the same advice, but what is that supposed to mean? even if I did 
> have a container field, I'm importing a file into a series of 
> records.... what is that supposed to mean?

Well if there is no container field, then what are you trying to import 
and to where are you trying to import it to?  Are you trying to import 
data from another file?  Or are you trying to store a file within a 
record as a blob?  Or...?  Don't you think that if others are posting 
the same advice, then maybe you're not properly explaining what you want 
to do?  You can blame FileMaker for a lot of things, but you can't blame 
it for your own ignorance.

>>Or if you are importing a folder of files at a time, you will see the 
>>file name and path as two separate fields that can be imported along 
>>with the images or other type of files.
> 
> hm, I tried setting the import script function to act on a folder, and 
> it let me set it up that way... but nothing gets imported. any one of 
> those files imports just fine, but tring to import the folder does 
> nothing.

When you import a folder, it is importing the files in that folder, each 
file into a separate record, into a container field.  Again, why would 
you want to only import the folder, and into what?  Is it data or some 
other kind of file or folder of files?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg              (818) 883-2846
FM Pro Solutions       Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance
0
Howard
11/15/2004 5:08:46 AM
> >>Have you tried setting a text field (or a calc) to 
> >>getastext(ContainerField)?
> > 
> > what does that mean? there IS no container field... I've seen others 
> > post the same advice, but what is that supposed to mean? even if I did 
> > have a container field, I'm importing a file into a series of 
> > records.... what is that supposed to mean?
> 
> Well if there is no container field, then what are you trying to import 
> and to where are you trying to import it to?  Are you trying to import 
> data from another file?  Or are you trying to store a file within a 
> record as a blob?  Or...?  Don't you think that if others are posting 
> the same advice, then maybe you're not properly explaining what you want 
> to do?  You can blame FileMaker for a lot of things, but you can't blame 
> it for your own ignorance.
> 
> >>Or if you are importing a folder of files at a time, you will see the 
> >>file name and path as two separate fields that can be imported along 
> >>with the images or other type of files.
> > 
> > hm, I tried setting the import script function to act on a folder, and 
> > it let me set it up that way... but nothing gets imported. any one of 
> > those files imports just fine, but tring to import the folder does 
> > nothing.
> 
> When you import a folder, it is importing the files in that folder, each 
> file into a separate record, into a container field.  Again, why would 
> you want to only import the folder, and into what?  Is it data or some 
> other kind of file or folder of files?
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Howard Schlossberg              (818) 883-2846


I'm trying to import a series of files, as that implies: import the 
columns of data in a text file into the database, one record per row, 
one field per column... just like import file does.

except, when importing from a folder, it stores the data info a 
container field... (that's not importing, it's storing, but whatever)... 
but I need that data imported into individual records, one per line, not 
one per file.

that approach did help, though, somewhat... except, I hit a dead end 
anyway:

importing the folders into a separate table I made for the job (e.g. 
fields: filename, filepath, somecontainer) does give me a good start by 
giving me a list of filepaths to programatically loop a file import 
script with...

except there's no way to feed a file path to the import function.

importing files one at a time (which is ok) provides no way to capture 
the file name, which must become a value in one of the target table's 
fields.

if I could affect an import scripts file path list, then I could stuff 
filepaths into it... but I can't.

or, if I could import records from a container field, then that would 
work. but I can't.

so any way around the problem, there's no wa to import a file and know 
its name (or do anything with it) at the same time.

filemaker has always had the potential to be the best database in the 
personal computer market, but it's always stopped just short of 
succeeding... this is only one such example.

it is the best database *tool* around, but it stops short of being a 
viable database *server*. that's a shame, it's really only a few 
oversights that stand in its way.

what's infuriating is the number of shortcomings that persist. this is 
my first peek at 7, and I was hoping all the hooplah of filemaker having 
addressed it's past issues held merit. but, I'm seeing all the usual 
suspects.
0
Bob
11/15/2004 5:51:57 AM
Bob,

go to www.abstrakt.com and get the shell-plugin. It is free (donationware).
It allows you to execute shell commands like "DIR D:\" and returns the
result of the command into a field.

Furthermore, since it is a plug-in, it will not asynchroniously execute
shell commands (as the execute command script step of filemaker does where
you have to pause a script to make sure that the command HAS BEEN executed).

What you need to do:
execute a DIR on the Folder in question.
parse the result-field for the files you want.
RENAME/MOVE or RENAME/COPY the file(s) you want to import to a fixed
location.
At that location you can import it with filemakers impaired import
function(s).

Loop until all files are imported.

Regards, Wolf


"Bob" <bob@nowhere.com> schrieb im Newsbeitrag
news:bob-91DFBA.21515714112004@shawnews.gv.shawcable.net...
> > >>Have you tried setting a text field (or a calc) to
> > >>getastext(ContainerField)?
> > >
> > > what does that mean? there IS no container field... I've seen others
> > > post the same advice, but what is that supposed to mean? even if I did
> > > have a container field, I'm importing a file into a series of
> > > records.... what is that supposed to mean?
> >
> > Well if there is no container field, then what are you trying to import
> > and to where are you trying to import it to?  Are you trying to import
> > data from another file?  Or are you trying to store a file within a
> > record as a blob?  Or...?  Don't you think that if others are posting
> > the same advice, then maybe you're not properly explaining what you want
> > to do?  You can blame FileMaker for a lot of things, but you can't blame
> > it for your own ignorance.
> >
> > >>Or if you are importing a folder of files at a time, you will see the
> > >>file name and path as two separate fields that can be imported along
> > >>with the images or other type of files.
> > >
> > > hm, I tried setting the import script function to act on a folder, and
> > > it let me set it up that way... but nothing gets imported. any one of
> > > those files imports just fine, but tring to import the folder does
> > > nothing.
> >
> > When you import a folder, it is importing the files in that folder, each
> > file into a separate record, into a container field.  Again, why would
> > you want to only import the folder, and into what?  Is it data or some
> > other kind of file or folder of files?
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Howard Schlossberg              (818) 883-2846
>
>
> I'm trying to import a series of files, as that implies: import the
> columns of data in a text file into the database, one record per row,
> one field per column... just like import file does.
>
> except, when importing from a folder, it stores the data info a
> container field... (that's not importing, it's storing, but whatever)...
> but I need that data imported into individual records, one per line, not
> one per file.
>
> that approach did help, though, somewhat... except, I hit a dead end
> anyway:
>
> importing the folders into a separate table I made for the job (e.g.
> fields: filename, filepath, somecontainer) does give me a good start by
> giving me a list of filepaths to programatically loop a file import
> script with...
>
> except there's no way to feed a file path to the import function.
>
> importing files one at a time (which is ok) provides no way to capture
> the file name, which must become a value in one of the target table's
> fields.
>
> if I could affect an import scripts file path list, then I could stuff
> filepaths into it... but I can't.
>
> or, if I could import records from a container field, then that would
> work. but I can't.
>
> so any way around the problem, there's no wa to import a file and know
> its name (or do anything with it) at the same time.
>
> filemaker has always had the potential to be the best database in the
> personal computer market, but it's always stopped just short of
> succeeding... this is only one such example.
>
> it is the best database *tool* around, but it stops short of being a
> viable database *server*. that's a shame, it's really only a few
> oversights that stand in its way.
>
> what's infuriating is the number of shortcomings that persist. this is
> my first peek at 7, and I was hoping all the hooplah of filemaker having
> addressed it's past issues held merit. but, I'm seeing all the usual
> suspects.


0
Wolf
11/15/2004 12:43:51 PM
hey, we might be almost there... I'm already able to collect the list of 
desired filenames (and paths) into a separate table... they're sitting 
in there as we speak, waiting for me to act on them.

here's the psuedo code for what I'm trying to make work... everything 
does except the dynamic import file step:



loop through list of filename/filepath records
  get filepath field from current record
  run import script with parameter(filepath)
end loop

begin import script
  -- here is where I get stuck
   import file( get(parameter) )
end import script



the question is: how do I command the import script step to import a 
specific file name? (I have the parameter passing working, I just don't 
know how to use that value within the import step.)


this is kind of critical to the prototype, of course.  ;o)  when isn't 
it.


thanks much guys and gals.
bob


In article <2vrmk3F2orrehU1@uni-berlin.de>,
 "Wolf Schwartz" <wolf@guerillaREMOVEMEsheepDOT.com> wrote:

> Bob,
> 
> go to www.abstrakt.com and get the shell-plugin. It is free (donationware).
> It allows you to execute shell commands like "DIR D:\" and returns the
> result of the command into a field.
> 
> Furthermore, since it is a plug-in, it will not asynchroniously execute
> shell commands (as the execute command script step of filemaker does where
> you have to pause a script to make sure that the command HAS BEEN executed).
> 
> What you need to do:
> execute a DIR on the Folder in question.
> parse the result-field for the files you want.
> RENAME/MOVE or RENAME/COPY the file(s) you want to import to a fixed
> location.
> At that location you can import it with filemakers impaired import
> function(s).
> 
> Loop until all files are imported.
> 
> Regards, Wolf
> 
> 
> "Bob" <bob@nowhere.com> schrieb im Newsbeitrag
> news:bob-91DFBA.21515714112004@shawnews.gv.shawcable.net...
> > > >>Have you tried setting a text field (or a calc) to
> > > >>getastext(ContainerField)?
> > > >
> > > > what does that mean? there IS no container field... I've seen others
> > > > post the same advice, but what is that supposed to mean? even if I did
> > > > have a container field, I'm importing a file into a series of
> > > > records.... what is that supposed to mean?
> > >
> > > Well if there is no container field, then what are you trying to import
> > > and to where are you trying to import it to?  Are you trying to import
> > > data from another file?  Or are you trying to store a file within a
> > > record as a blob?  Or...?  Don't you think that if others are posting
> > > the same advice, then maybe you're not properly explaining what you want
> > > to do?  You can blame FileMaker for a lot of things, but you can't blame
> > > it for your own ignorance.
> > >
> > > >>Or if you are importing a folder of files at a time, you will see the
> > > >>file name and path as two separate fields that can be imported along
> > > >>with the images or other type of files.
> > > >
> > > > hm, I tried setting the import script function to act on a folder, and
> > > > it let me set it up that way... but nothing gets imported. any one of
> > > > those files imports just fine, but tring to import the folder does
> > > > nothing.
> > >
> > > When you import a folder, it is importing the files in that folder, each
> > > file into a separate record, into a container field.  Again, why would
> > > you want to only import the folder, and into what?  Is it data or some
> > > other kind of file or folder of files?
> > >
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > Howard Schlossberg              (818) 883-2846
> >
> >
> > I'm trying to import a series of files, as that implies: import the
> > columns of data in a text file into the database, one record per row,
> > one field per column... just like import file does.
> >
> > except, when importing from a folder, it stores the data info a
> > container field... (that's not importing, it's storing, but whatever)...
> > but I need that data imported into individual records, one per line, not
> > one per file.
> >
> > that approach did help, though, somewhat... except, I hit a dead end
> > anyway:
> >
> > importing the folders into a separate table I made for the job (e.g.
> > fields: filename, filepath, somecontainer) does give me a good start by
> > giving me a list of filepaths to programatically loop a file import
> > script with...
> >
> > except there's no way to feed a file path to the import function.
> >
> > importing files one at a time (which is ok) provides no way to capture
> > the file name, which must become a value in one of the target table's
> > fields.
> >
> > if I could affect an import scripts file path list, then I could stuff
> > filepaths into it... but I can't.
> >
> > or, if I could import records from a container field, then that would
> > work. but I can't.
> >
> > so any way around the problem, there's no wa to import a file and know
> > its name (or do anything with it) at the same time.
> >
> > filemaker has always had the potential to be the best database in the
> > personal computer market, but it's always stopped just short of
> > succeeding... this is only one such example.
> >
> > it is the best database *tool* around, but it stops short of being a
> > viable database *server*. that's a shame, it's really only a few
> > oversights that stand in its way.
> >
> > what's infuriating is the number of shortcomings that persist. this is
> > my first peek at 7, and I was hoping all the hooplah of filemaker having
> > addressed it's past issues held merit. but, I'm seeing all the usual
> > suspects.
> 
>
0
Bob
11/15/2004 6:43:35 PM
Hi Bob,

you set up the import step by giving it a file reference (relative/absolute
location)
I think the script step is import records and you can run it without dialog
if you set up the file reference to it.

Thats why you need a rename/copy script step before (using the shell
extension), so your file is at a "always known location"
You can use the shell plugin after the import to delete the file.


Probably the best approach is to use a relative path file, since you can set
up a temp folder in your solution and do this without cluttering your
solution files.

So the sequence of events is:

1. You have a list of filenames (full path preferably)

2. Loop through the list and do:

a. rename/copy file to a known location (You can get your solutions file
path by using and tampering with the Get() function)
SHELL: "Copy " & quote(field::sourcefile) & " " & quote(field::destfile)
You need the quotes if there are spaces in the filepath/name!

b. import records with no dialog (file reference is set to the renamed file)
c. loop until end of list
d. delete the last import file (the previous ones are overwritten.. i havent
tested this with the shell plugin, if it doesnt overwrite you need a "delete
the imported file" step after importing inside the loop)

You dont need a parameter passing as the import records step doesn't accept
a variable.

Come any clearer yet :) ?

Regards, Wolf

"Bob" <bob@nowhere.com> schrieb im Newsbeitrag
news:bob-39142A.10433515112004@shawnews.gv.shawcable.net...
> hey, we might be almost there... I'm already able to collect the list of
> desired filenames (and paths) into a separate table... they're sitting
> in there as we speak, waiting for me to act on them.
>
> here's the psuedo code for what I'm trying to make work... everything
> does except the dynamic import file step:
>
>
>
> loop through list of filename/filepath records
>   get filepath field from current record
>   run import script with parameter(filepath)
> end loop
>
> begin import script
>   -- here is where I get stuck
>    import file( get(parameter) )
> end import script
>
>
>
> the question is: how do I command the import script step to import a
> specific file name? (I have the parameter passing working, I just don't
> know how to use that value within the import step.)
>
>
> this is kind of critical to the prototype, of course.  ;o)  when isn't
> it.
>
>
> thanks much guys and gals.
> bob
>
>
> In article <2vrmk3F2orrehU1@uni-berlin.de>,
>  "Wolf Schwartz" <wolf@guerillaREMOVEMEsheepDOT.com> wrote:
>
> > Bob,
> >
> > go to www.abstrakt.com and get the shell-plugin. It is free
(donationware).
> > It allows you to execute shell commands like "DIR D:\" and returns the
> > result of the command into a field.
> >
> > Furthermore, since it is a plug-in, it will not asynchroniously execute
> > shell commands (as the execute command script step of filemaker does
where
> > you have to pause a script to make sure that the command HAS BEEN
executed).
> >
> > What you need to do:
> > execute a DIR on the Folder in question.
> > parse the result-field for the files you want.
> > RENAME/MOVE or RENAME/COPY the file(s) you want to import to a fixed
> > location.
> > At that location you can import it with filemakers impaired import
> > function(s).
> >
> > Loop until all files are imported.
> >
> > Regards, Wolf
> >
> >
> > "Bob" <bob@nowhere.com> schrieb im Newsbeitrag
> > news:bob-91DFBA.21515714112004@shawnews.gv.shawcable.net...
> > > > >>Have you tried setting a text field (or a calc) to
> > > > >>getastext(ContainerField)?
> > > > >
> > > > > what does that mean? there IS no container field... I've seen
others
> > > > > post the same advice, but what is that supposed to mean? even if I
did
> > > > > have a container field, I'm importing a file into a series of
> > > > > records.... what is that supposed to mean?
> > > >
> > > > Well if there is no container field, then what are you trying to
import
> > > > and to where are you trying to import it to?  Are you trying to
import
> > > > data from another file?  Or are you trying to store a file within a
> > > > record as a blob?  Or...?  Don't you think that if others are
posting
> > > > the same advice, then maybe you're not properly explaining what you
want
> > > > to do?  You can blame FileMaker for a lot of things, but you can't
blame
> > > > it for your own ignorance.
> > > >
> > > > >>Or if you are importing a folder of files at a time, you will see
the
> > > > >>file name and path as two separate fields that can be imported
along
> > > > >>with the images or other type of files.
> > > > >
> > > > > hm, I tried setting the import script function to act on a folder,
and
> > > > > it let me set it up that way... but nothing gets imported. any one
of
> > > > > those files imports just fine, but tring to import the folder does
> > > > > nothing.
> > > >
> > > > When you import a folder, it is importing the files in that folder,
each
> > > > file into a separate record, into a container field.  Again, why
would
> > > > you want to only import the folder, and into what?  Is it data or
some
> > > > other kind of file or folder of files?
> > > >
> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > Howard Schlossberg              (818) 883-2846
> > >
> > >
> > > I'm trying to import a series of files, as that implies: import the
> > > columns of data in a text file into the database, one record per row,
> > > one field per column... just like import file does.
> > >
> > > except, when importing from a folder, it stores the data info a
> > > container field... (that's not importing, it's storing, but
whatever)...
> > > but I need that data imported into individual records, one per line,
not
> > > one per file.
> > >
> > > that approach did help, though, somewhat... except, I hit a dead end
> > > anyway:
> > >
> > > importing the folders into a separate table I made for the job (e.g.
> > > fields: filename, filepath, somecontainer) does give me a good start
by
> > > giving me a list of filepaths to programatically loop a file import
> > > script with...
> > >
> > > except there's no way to feed a file path to the import function.
> > >
> > > importing files one at a time (which is ok) provides no way to capture
> > > the file name, which must become a value in one of the target table's
> > > fields.
> > >
> > > if I could affect an import scripts file path list, then I could stuff
> > > filepaths into it... but I can't.
> > >
> > > or, if I could import records from a container field, then that would
> > > work. but I can't.
> > >
> > > so any way around the problem, there's no wa to import a file and know
> > > its name (or do anything with it) at the same time.
> > >
> > > filemaker has always had the potential to be the best database in the
> > > personal computer market, but it's always stopped just short of
> > > succeeding... this is only one such example.
> > >
> > > it is the best database *tool* around, but it stops short of being a
> > > viable database *server*. that's a shame, it's really only a few
> > > oversights that stand in its way.
> > >
> > > what's infuriating is the number of shortcomings that persist. this is
> > > my first peek at 7, and I was hoping all the hooplah of filemaker
having
> > > addressed it's past issues held merit. but, I'm seeing all the usual
> > > suspects.
> >
> >


0
Wolf
11/16/2004 12:44:11 PM
yes, I see your approach now.

this is considered elegant, filemaker? and even this needs an external 
plug in.

thanks wolf, I wouldn't have figured out such a convoluted way around 
the problem. at least this can work.

bob


In article <2vub0sF2pjnrqU1@uni-berlin.de>,
 "Wolf Schwartz" <wolf@guerillaREMOVEMEsheepDOT.com> wrote:

> Hi Bob,
> 
> you set up the import step by giving it a file reference (relative/absolute
> location)
> I think the script step is import records and you can run it without dialog
> if you set up the file reference to it.
> 
> Thats why you need a rename/copy script step before (using the shell
> extension), so your file is at a "always known location"
> You can use the shell plugin after the import to delete the file.
> 
> 
> Probably the best approach is to use a relative path file, since you can set
> up a temp folder in your solution and do this without cluttering your
> solution files.
> 
> So the sequence of events is:
> 
> 1. You have a list of filenames (full path preferably)
> 
> 2. Loop through the list and do:
> 
> a. rename/copy file to a known location (You can get your solutions file
> path by using and tampering with the Get() function)
> SHELL: "Copy " & quote(field::sourcefile) & " " & quote(field::destfile)
> You need the quotes if there are spaces in the filepath/name!
> 
> b. import records with no dialog (file reference is set to the renamed file)
> c. loop until end of list
> d. delete the last import file (the previous ones are overwritten.. i havent
> tested this with the shell plugin, if it doesnt overwrite you need a "delete
> the imported file" step after importing inside the loop)
> 
> You dont need a parameter passing as the import records step doesn't accept
> a variable.
> 
> Come any clearer yet :) ?
> 
> Regards, Wolf
0
Bob
11/16/2004 6:28:52 PM
It can be done without plug-ins, but it gets even a little
more convoluted.  You could use the Send Message step to call a DOS 
command: "cmd /c dir >directory.txt" and then import the resulting text 
file into an FMP table to loop through and grab the info you want.

Bob wrote:
> yes, I see your approach now.
> 
> this is considered elegant, filemaker? and even this needs an external 
> plug in.
> 
> thanks wolf, I wouldn't have figured out such a convoluted way around 
> the problem. at least this can work.
> 
> bob
> 
> 
> In article <2vub0sF2pjnrqU1@uni-berlin.de>,
>  "Wolf Schwartz" <wolf@guerillaREMOVEMEsheepDOT.com> wrote:
> 
> 
>>Hi Bob,
>>
>>you set up the import step by giving it a file reference (relative/absolute
>>location)
>>I think the script step is import records and you can run it without dialog
>>if you set up the file reference to it.
>>
>>Thats why you need a rename/copy script step before (using the shell
>>extension), so your file is at a "always known location"
>>You can use the shell plugin after the import to delete the file.
>>
>>
>>Probably the best approach is to use a relative path file, since you can set
>>up a temp folder in your solution and do this without cluttering your
>>solution files.
>>
>>So the sequence of events is:
>>
>>1. You have a list of filenames (full path preferably)
>>
>>2. Loop through the list and do:
>>
>>a. rename/copy file to a known location (You can get your solutions file
>>path by using and tampering with the Get() function)
>>SHELL: "Copy " & quote(field::sourcefile) & " " & quote(field::destfile)
>>You need the quotes if there are spaces in the filepath/name!
>>
>>b. import records with no dialog (file reference is set to the renamed file)
>>c. loop until end of list
>>d. delete the last import file (the previous ones are overwritten.. i havent
>>tested this with the shell plugin, if it doesnt overwrite you need a "delete
>>the imported file" step after importing inside the loop)
>>
>>You dont need a parameter passing as the import records step doesn't accept
>>a variable.
>>
>>Come any clearer yet :) ?
>>
>>Regards, Wolf

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg              (818) 883-2846
FM Pro Solutions       Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance
0
Howard
11/16/2004 7:10:13 PM
Hi Howard, hi Bob,

Yup, i know.
Doing that has the added convolutedness that send message commands are
executed asynchronously.. meaning filemaker sends the command and then
immediately goes on with the script.
In the USUAL circumstance that you send a DIR command to >file.txt, you
cannot immediately afterwards in your script ASSUME that the file has been
created and/or created and filled with the data. (Well, maybe on a pentium
I, 33mhz :)
You must pause the script at least for two seconds to allow for completion
of the send message command DIR ... on a decently large directory of say
100-300 files. (Given a 2mhz P4 or something like that)
Now if you wanna script THAT  impairment out of the script... even more
convolutions.
So the approach with the shell plugin does take out a lot of hassles, since
execution of the script continues when the shell command has completed.
(Having been through all of this by trial and error myself, I do have some
firsthand experience... unfortunately)

I finally arrived at a solution where i have a separate "parsing file" that
executes and then chews on the result of the shell command and returns a
value list or "OK" or whatever i've told it to. That way i can at least
simply reuse that file in other solutions. I call specific scripts in the
parsing file, giving it a calculated script parameter. Then I pull out the
digested data from a global or a table.

I do understand that doing things like the above is beyond the scope of
filemaker, but why they are using their fixed file reference model (which
has its merits in keeping a solution "together") in their importing steps
instead of (or additionally) allowing the passing of a path/file (or dialog)
is completely beyond my understanding.

hm..., i hope now i didnt sound too convoluted :p
Regards, Wolf


"Howard Schlossberg" <howard@antispahm.fmprosolutions.com> schrieb im
Newsbeitrag news:10pkk55a9u3vn6b@corp.supernews.com...
> It can be done without plug-ins, but it gets even a little
> more convoluted.  You could use the Send Message step to call a DOS
> command: "cmd /c dir >directory.txt" and then import the resulting text
> file into an FMP table to loop through and grab the info you want.
>
> Bob wrote:
> > yes, I see your approach now.
> >
> > this is considered elegant, filemaker? and even this needs an external
> > plug in.
> >
> > thanks wolf, I wouldn't have figured out such a convoluted way around
> > the problem. at least this can work.
> >
> > bob
> >
> >
> > In article <2vub0sF2pjnrqU1@uni-berlin.de>,
> >  "Wolf Schwartz" <wolf@guerillaREMOVEMEsheepDOT.com> wrote:
> >
> >
> >>Hi Bob,
> >>
> >>you set up the import step by giving it a file reference
(relative/absolute
> >>location)
> >>I think the script step is import records and you can run it without
dialog
> >>if you set up the file reference to it.
> >>
> >>Thats why you need a rename/copy script step before (using the shell
> >>extension), so your file is at a "always known location"
> >>You can use the shell plugin after the import to delete the file.
> >>
> >>
> >>Probably the best approach is to use a relative path file, since you can
set
> >>up a temp folder in your solution and do this without cluttering your
> >>solution files.
> >>
> >>So the sequence of events is:
> >>
> >>1. You have a list of filenames (full path preferably)
> >>
> >>2. Loop through the list and do:
> >>
> >>a. rename/copy file to a known location (You can get your solutions file
> >>path by using and tampering with the Get() function)
> >>SHELL: "Copy " & quote(field::sourcefile) & " " & quote(field::destfile)
> >>You need the quotes if there are spaces in the filepath/name!
> >>
> >>b. import records with no dialog (file reference is set to the renamed
file)
> >>c. loop until end of list
> >>d. delete the last import file (the previous ones are overwritten.. i
havent
> >>tested this with the shell plugin, if it doesnt overwrite you need a
"delete
> >>the imported file" step after importing inside the loop)
> >>
> >>You dont need a parameter passing as the import records step doesn't
accept
> >>a variable.
> >>
> >>Come any clearer yet :) ?
> >>
> >>Regards, Wolf
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Howard Schlossberg              (818) 883-2846
> FM Pro Solutions       Los Angeles, California
>
> FileMaker 7 Certified Developer
> Associate Member, FileMaker Solutions Alliance


0
Wolf
11/17/2004 1:44:39 AM
wo... ok, i'm with you from a strategy perspective, but the 
record/filename looping code... my mind is mush at the moment, please 
forgive the newbie question.

anyone help me with the obvious here?

thanks,
b
0
Bob
11/17/2004 4:20:06 AM
Hi bob,

sure. No problem. Lets start with the obvious, shall we?

1. You do need the shell plugin.
2. I assume the files you want to import can be placed at a fixed/known
location?
Like a special desktop folder or a "import_me" folder that resides in your
solution folder?
If it is a fixed location (hard coded path) i would still suggest you set up
a variable for maintenance reasons.
If it is a relative path to your solution, you can have filemaker calculate
it. Below is a calculation for a relative path:

field g_ImportFolder(Text)
field g_ImportPath(Calculation, Text) =
Substitute( Get(FilePath) & g_ImportFolder;
["file:/";""];[".fp7";""];[Get(FileName);""];["/";"\\"] )

Enter: "ImportFiles/" into g_importfolder (or nothing if you place your
import files into the solution folder)

Result of this would be like: "D:\fp7files\mysolution\ImportFiles\"

Please note, as we're using DOS command(s), we need "\" instead of "/" so
the calculation replaces them.
Also note that "\" is a filemaker "escape" character so \\ in the substitute
equates to \

Ok, now we're basically set up for the shell command to work its magic

field g_command = text
field g_result = text

enter
g_command = "DIR " & Quote(g_ImportPath)

Script:
Name "Execute" has 1 step:

Set Field [g_result; External( "shell-Execute"; Evaluate(g_command) ) ]

Run the script and if your import folder doesnt exist, you'll get an error
message, else you get a listing


You with me this far ?


Cheers, Wolf


"Bob" <bob@nowhere.com> schrieb im Newsbeitrag
news:bob-FEDCDC.20200616112004@shawnews.gv.shawcable.net...
> wo... ok, i'm with you from a strategy perspective, but the
> record/filename looping code... my mind is mush at the moment, please
> forgive the newbie question.
>
> anyone help me with the obvious here?
>
> thanks,
> b


0
Wolf
11/17/2004 1:44:08 PM
> Ok, now we're basically set up for the shell command to work its magic
> 
> field g_command = text
> field g_result = text
> 
> enter
> g_command = "DIR " & Quote(g_ImportPath)
> 
> Script:
> Name "Execute" has 1 step:
> 
> Set Field [g_result; External( "shell-Execute"; Evaluate(g_command) ) ]
> 
> Run the script and if your import folder doesnt exist, you'll get an error
> message, else you get a listing
> 
> 
> You with me this far ?
> 
> 
> Cheers, Wolf

if I'm reading this correctly, you're stuffing a directory list into a 
table, one record per filename/pathname... that I already have done.

it's the rest I was looking for. please go on.


I need a dumb question answered, but I can't find the answer anyuwhere

re: filemaker 7, find requests... how do I reference a field in a find 
request. e.g.

thistable::topic == categories::g_category



thanks,
B
0
Bob
11/18/2004 10:10:13 PM
Reply: