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

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

Recommended Posts

Posted

Once again, cerebral density has raised its ugly head (that's why I don't post a picture of myself);)

I have a runtime that I want to be able to import records with from the desktop. The problem is, the runtime doesn't "know" how to map the Source fields to the Target fields for import in the Import Field Mapping windoid. (The Source side is blank.) How do I code the Import Records script step so it'll pre-match the field names ("arrange by: matching names")so the import can take place?

TIA for your help,

Rich

Posted

First you need a file which is just like the one you're going to import, choose its type of file in the dialog (dropdown). Then create a script with an Import Records step, and you can match fields to your file. If you run this script it should default to that order, even if you target another file of that type (not sure how reliably).

You will need the original file, or one named and structured like it, if you later want to adjust the Import order.

But the best way is if you can pass the file path to FileMaker (either relative or absolute) to set into a script $variable. FileMaker can calculate the Desktop path (if the file is directly on the desktop). It's a little difficult however to get that file path/name first using just a FileMaker dialog (because you don't know the name of the file, unless you always have the same name, in which case it should just work).

There is at least one free plug-in which can do this, MooPlug. I believe it returns a Windows OS syntax file path, so you'd need to coerce that to a FileMaker syntax path (easy).

You then set the FileMaker syntax path into a script variable;

Set Variable [ $path; "the FileMaker syntax path" ]

Then use that script variable as the 1st line in the "path" dialog of the Import Records step:

$path (no quotes)

path to original file (which ain't there most of the time)

This tells FileMaker to look first at the path specified by the $path variable. If it is not there, then look for the original file's path. This should work reliably in a scripted Import of a "same-structured" file.

If you want to reset the Import order, you just put the original file (or one like it) in the place it is expected. Then the source fields will be there, and you adjust. Then save the script's changes.

Posted

Hi, Fenton:

Yup, I'm using a good path to get to the desktop:

Case (Abs ( Get ( SystemPlatform )) = 1; "filemac:"; "filewin:") & Get ( DesktopPath ) & "CL Job.fp7"

I think I answered my own question: While in the Import Mapping windoid I set it to look for the same fieldnames and clicked the appropriate arrows to the fields I wanted to import--it works.

Where I'm running into trouble now is trying to import fields generated in two separate tables in the export files. Good thing I have a bottle of Tylenol handy. ;)

Posted

Two tables is just 2 Import Records steps. If the path is good, you can choose a different Source table, and a Target table. I usually go to the Target layout first. Since this is scripted, with no dialog, you cannot even see that it's doing 2, unless you watch the import progress bar start over again.

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