Jump to content
Server Maintenance This Week. ×

Using Get(TemporaryPath) to export / import between tables


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

Recommended Posts

Hello,

I recently became aware that you cannot import from one table to another using a server side script. I read that it should be done by exporting records from one table using Get(TemporaryPath) and importing using the same. 

I started fiddling with this and created a script like the one below in a test file. 

        Go to Layout ["Export data" (export); animation:none]

        Set Variable [$v_path; value: Get(TemporaryPath) & "test_file.xlsx"]

        Export Records [With dialog:off; Create folers:On; "$v_path"; windows (ANSI)]

        Go to Layout ["Import data" (import); animation:none]

        Import Records [With dialog:off; Table: import; "$v_path"; Add; Windows ANSI]

 

When I run it I get the error below. The file gets created during the export and I tried to MANUALLY import it and it worked fine. I tried renaming it. I tried creating as a text file and as a csv file. I have tried using ASCII (DOS) but get the same error. Is there a step I am missing or a file type that is required?

I am running this on a local machine, not as a server side script. I am running filemaker 19 pro and server on a windows machine (windows 10 local, windows server 16)

The one thing I am unsure about is the delimiter. If I am exporting into an excel file and I am exporting a field, why would I need a delimiter? In the final version of this I will using email data to transfer which will have all kinds of punctuation in it, but I want the body of the email to be in one field regardless. Also the auto enter, preserve external container storage and repeating field boxes are all grayed out so I can't change them. 

Any help would be greatly appreciated. 

 

Mike

image.png.bc59bc91e7e6cdf07d61d1e599161b03.png

Link to comment
Share on other sites

Are you sure you have selected Excel Workbooks (.xslx) as the format for both the Export Records and the Import Records script steps? From your mention of a delimiter, I would guess not.

BTW, Excel is not a good choice for an interim format. It has an unfortunate tendency to misinterpret data types. I would recommend you select the XML format, using the FMPXMLRESULT grammar, for the described task (assuming no container fields are involved).

 

Link to comment
Share on other sites

Ok, so I feel more than a little silly. I was so focused on the "Specify import order" I overlooked the obvious. Thank you

Though even when I did specify excel it still showed the delimiter not grayed out which freaked me out a little but when it imported it worked. 

Thanks also for the tip on XML. I know nothing about XML so I was hesitant but it seems to work just fine without my needing to know! 

Link to comment
Share on other sites

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