Re: Path name to variable



Aladino wrote:
With Filemaker 8.5 (I work with developer 9 but script should work with
Pro 8.5), is there a way to puth a file path in a variable?
I need it to make a import script, that imports multi-table files that I
can't now the path before, and I won't have 4 open file dialogs each
import (one for table)...
I saw that putting an example filepath in a variable, and using the
variable as import path, works fine, but now I want to select the file
with an open file dialog and get the path to put in the variable.



I do quite a bit of scripted import/export; this is extract of what I use on FM9Av3 on Mac OSX.5.5


Set Error Capture [ On ]
#
Set Variable [ $_PATH; Value:Let([
FP = Get ( FilePath ) ;
FN = Get ( FileName ) ;
FPstub = Substitute( FP ; FN & ".fp7"; "" ) ;
TO = "export/"
];
FPstub & TO
) ]
#
#

#==================================================
Go to Layout [ “Patients” (Patients) ]
Set Variable [ $_imp; Value:$_PATH & Get ( LayoutTableName ) ]
Import Records [ Source: “$_imp”; Target: “Patients”; Method: Add; Character Set: “Mac Roman”; Field Mapping: Source field 1
import to Patients::NameLast
Source field 2 import to Patients::NameFirst

[ No dialog ]
#
#capture the PatID - use to update dependents
Set Variable [ $_Pat; Value:Patients::Pat_ID ]
#
#==================================================


The initial path can be calculated from the location of the parent file (the one being imported into). In this case the target file is in a sub directory: /export. (20 or so exported tables (i.e. files have been created in this holding/transfer directory)


The initial calc variable sets the path stub.
The exports files adopt the origin table name.
stepping through the layouts and show all/delete all is required (as your later post) in this particular situation.
The serial number ID for each table is reset


One thing that will make it considerably more involved is where there are multiple table dependencies parent/child/grand child...
and the parent ID is captured to variable, loop sub-routines encode the NEW parent ID at import... hence the
#capture the PatID - use to update dependents
indication.


Note that if you clone the file with the import script, mapping will be 'lost' . This is another discussion unto itself, but if you clone, RECHECK the mappings.
.



Relevant Pages

  • createElement(script) in iframes parent page
    ... I had an iframe in the same domain as it's parent page (so no x-security ... When I was debugging the code I would encounter the ... "interactive" state as also good enough to create the script element. ...
    (microsoft.public.scripting.jscript)
  • Re: CSVDE Importing
    ... > specify the log file path via the -j option. ... CSVDE imports can only be used to create new users ... Unfortunately, the syntax is a bit more involved than a simple csv file, ... which makes it a little more difficult to manage its content via script. ...
    (microsoft.public.windows.server.scripting)
  • Re: CSVDE Importing
    ... > specify the log file path via the -j option. ... CSVDE imports can only be used to create new users ... Unfortunately, the syntax is a bit more involved than a simple csv file, ... which makes it a little more difficult to manage its content via script. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Finding the lowest OU a user is in
    ... In a logon script you can use the ADSystemInfo object to retrieve the ... then use the Parent method to retrieve the Distinguished Name of the parent ... ' Retrieve DN of Parent container. ...
    (microsoft.public.scripting.vbscript)
  • Re: Login scripts based on Organisational Units
    ... ' Retrieve DN of parent OU/Container. ... ' Replace any escaped commas with Chr. ... ' Parse Parent DN into comma delimited components. ... whereas a script based on group membership may be ...
    (microsoft.public.windows.server.general)