Can I get SqlExplorer to indicate table presence?

General support questions.
Posts: 6
Joined: Sat Apr 04, 2009 5:20 pm
PostPosted: Wed Sep 04, 2013 12:16 am
I have an Filemaker 12 import script that performs as follows:
The user browses to where the Source file is located and selects it.
The script assigns the variable $Filename to the selected file. (ie, LM144.fmpur)
I then delete each table in the Target file and then import each table in LM144.fmpur.

This works.... unless....
... I have added a table in the Target file and the same table is 'missing' in the Source file.

Question: "Can I use SQLExplorer to construct a query that would look at the Source file and see if a specified table is present?" If so, what would it look like? I am really stuck.

Thank you

Ron
SeedCode Staff
SeedCode Staff
Posts: 686
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Fri Sep 06, 2013 6:46 am
Hi Ron,

You can't do this with SQL, but you can possibly use the FileMaker Design functions. Providing the file is open, then TableNames ( filename ) should give you a list of the existing table occurences.

FMSQL needs to have a table occurrence reference in the target file for it to be visible to a query.

hth,
Jason
Posts: 6
Joined: Sat Apr 04, 2009 5:20 pm
PostPosted: Fri Sep 06, 2013 10:59 am
JasonYoung wrote:Hi Ron,

You can't do this with SQL, but you can possibly use the FileMaker Design functions. Providing the file is open, then TableNames ( filename ) should give you a list of the existing table occurences.

FMSQL needs to have a table occurrence reference in the target file for it to be visible to a query.

hth,
Jason


OK. How do I 'Open' the user selected file? (I have the selected file name and path in $$Path)
SeedCode Staff
SeedCode Staff
Posts: 686
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Fri Sep 06, 2013 12:08 pm
Hi,

Right, you'd have to have a file reference to the source file to open it. If you have that, then you can do it with the open file script step. However, that may not be practical if the file name and location can change.

Other than that, there's no easy way to open a FileMaker file from another FileMaker file.

The possible "trick" you could try would be to write a script that:

1) inserts the FileMaker file into a container field and then exports it somewhere else (like the temp path).
2) When you export the file from a container you have the option of opening the file.
3) Now that the file is open the design functions can do their check, and then proceed with the import if the table's there.
4) You'll have the path you exported and opened the file to, so you could just point the import there as it will be exactly the same as your original source file. That way they just need to pick the file once, only they'll be inserting the file rather that importing its records.

Untested and only a theory, but I think it might work 8)

Let us know if that helps,
-Jason
Posts: 6
Joined: Sat Apr 04, 2009 5:20 pm
PostPosted: Fri Sep 06, 2013 4:28 pm
JasonYoung wrote:Hi,

Right, you'd have to have a file reference to the source file to open it. If you have that, then you can do it with the open file script step. However, that may not be practical if the file name and location can change.

Other than that, there's no easy way to open a FileMaker file from another FileMaker file.

The possible "trick" you could try would be to write a script that:

1) inserts the FileMaker file into a container field and then exports it somewhere else (like the temp path).
2) When you export the file from a container you have the option of opening the file.
3) Now that the file is open the design functions can do their check, and then proceed with the import if the table's there.
4) You'll have the path you exported and opened the file to, so you could just point the import there as it will be exactly the same as your original source file. That way they just need to pick the file once, only they'll be inserting the file rather that importing its records.

Untested and only a theory, but I think it might work 8)

Let us know if that helps,
-Jason

Hi Jason,
Your idea sounds workable. I will give it a try and let you know. (Isn't this an incredible hassle? Shouldn't it be easier than jumping through all these hoops? And last, 'Isn't this a business opportunity for a company like SeedCode to 'fill the gap' that Filemaker created and make this process easy? (If so, put me down as a beta tester! 8-)
Last edited by synergy46 on Fri Sep 06, 2013 4:43 pm, edited 1 time in total.
SeedCode Staff
SeedCode Staff
Posts: 686
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Fri Sep 06, 2013 4:42 pm
Cool, please do.

Cheers and have a great Weekend!

Return to General Support

Who is online

Users browsing this forum: No registered users and 1 guest

(855) SEEDCODE
support@seedcode.com
Follow us: