Editing a Scripted Import

I routinely import a csv file into a temp table. Occasionally, I need to edit the field mapping, I was under the impression scripted imports could not be edited and had to be rebuilt when changes were required.

However, today I read a comment on another forum which stated, “You can edit it directly in the script if you have the data source loaded…”

Question: Is editing a scripted import possible, and what does “have the data source loaded” mean?

Yes, you can edit the field mapping. You do this by specifying that import dialog is displayed for the user, who then controls the import.

Having the data source loaded simply means that a file reference has been specified in the script step, and that there is a file in that spot.

If you want the changes to be permanent you need to edit the script.

I was under the impression you cannot save changes to a scripted import. I’ll have another look at this, thanks.

not every new thing is better by default..

I got a customer who is still running FileMaker 6 for several reason - and that customer needs to change some processes (bank data, etc.)

I already created a new version of the db-application in 19.x, but they never found time for testing...

So, I created e new app under FM 19.5 for reading bank data, created an export in csv - and imported that into FM6 for further processing

In FM6, when one creates an import (export similar) script and change the import-mapping, FM6 ask if the mapping should be replaced or not.

With that in mind (we did a lot of work using FM6 and older, long time ago), I never thought that it is not possible to alter field-mapping...

1 Like

If you mean that the user can't save his mapping when the script runs, as suggested by @Malcolm, then you are correct. The user will be able to map the import, however that mapping will be forgotten once the import completes.

If you mean that you can't save a mapping change by editing your script, then you are incorrect. Editing the import mapping when editing a script is saved when you re-save the script.

1 Like

Agree, this is confusing. You can edit the field mapping in the script, but you can only do this if you have an actual file selected in the Specify Data Source option. But sometimes that file doesn't exist yet (perhaps it is the result of a download step, or a previous export step).

How do you set up field mapping?

Here's a trick I use sometimes:

Basically, I set up 2 import files - the first one only exists on my development machine for TEST, and I can use that to set up the import mapping.

When running on another computer in PRODUCTION, the first path is not found, but the second path (set via a variable I call $path in the script) is found.

One needs to be careful with this technique, as behavior is now dependent on which machine is being used, but I find it comes in handy sometimes...

1 Like

Good tip @xochi.

I do this too, but in reverse. The production path goes first, the development path second.

The system will probe for each file in the list until it gets a result. That takes time, and I don't want to waste time probing for test data --but most importantly-- what would happen if development path resolved correctly for a production user? :exploding_head:

3 Likes

That's the way I do it too, but befor saving the script, I delete the reference to thefile for testing :slight_smile:

1 Like