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

Beginner: perform a search - get the result as array


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

Recommended Posts

  • Newbies
Posted

Hi there,

I'm writing a ScriptMaster-Plugin to upload data from a database to an FTP-Server.

FTP stuff is clear but I'm having trouble with more basic stuff.

I want to perform a search on a table and get the result in an array.

By looking through the examples I figured out how to access FM's calculation engine but I still don't know how to access the database and get records to deal with.

Any help, hint or example would be appreciated.

Regards,

Lumpi23

Posted (edited)

I would suggest executing the Find within Filemaker's scripting language.

You can then use GetNthRecord(table::field;record#) to obtain the contents of field 'field' of record 'record#' in table 'table'. There is a good example of looping through a found set in the 'Access the FileMaker Calculation Engine Part 3' sample script that comes with ScriptMaster. Note that record number above, means 'record number in the current found set'.

You may also want to consider having the Filemaker script tabulate the data, store it in a global field, export this field to a file, and then call the scriptmaster script to ftp it. I don't know enough about the problem to determine if that's a better or faster method or not.

I've done the ftp part with both ScriptMaster and the DOS ftp command, DOS ftp can run concurrently with FM (nice for long files), and doesn't require a plugin, but it isn't as flexible as ScriptMaster which can do ftps, etc. http://fmforums.com/forum/showtopic.php?tid/216556/pid/364984/post/last/m/1/ is an example.

Edited by Guest
  • Newbies
Posted

Thank You for Your help.

So if I get You right, theres no way of easily accessing data in the database from the ScriptMaster code itself, without to "prepare" a search result in an FM Script? So, as a consequence, data manipulation is not possible from there, either?

I'm doing the FTP-upload using the "Jakarta Commons Net-Library" from apache.org:

http://commons.apache.org/net/

But if I'm thinking about your suggestion to export the data from each field, then an external upload would be more efficient.

Anyway, thank You very much!

Regards,

André

Posted

you have access to FileMaker data and to container fields. The fmpro object gives you access to those container fields via fmpro.getContainerStream( fieldName ).

To have complete access to the database data you need to buy the advanced version of ScriptMaster to access the database via SQL. However in your case you could simply create a loop that loops through the records with containerfields and perform the upload (if I understood your problem well).

  • Newbies
Posted

This sounds good to me, but I can only find the "getContainerStream" function in the ScriptMaster Doc. Is there a "getField" function? Or do I have to treat text-fields as containers as well, reading the text as a byte stream?

Posted

From the ScriptMaster docs:

getContainerStream( fieldName )

Gets an input stream with bytes from the container field. Be sure to pass in the NAME of the container field, ie fmpro.getContainerStream( "Person::Photo" )

This will return a java.io.InputStream

You can also use the getContainerFileName if you want to find the name of the file stored in the container field:

getContainerFileName( fieldName )

Gets the name of the file stored in a container field. Be sure to pass in the NAME of the container field, ie fmpro.getContainerFileName( "Person::Photo" ) might return 'jesse.jpg'

Posted

Hi Jesse

thanks, but if I create an object using the fmpro.getContainerStream() method, and I apply the getClass() method to this object, I get as a result "FMBinary". As I understood (correct me if I am wrong) inputStream is an abstract class, so can I conclude the FMBinary is simply a subclass of inputStream?

Andries

Posted

Here's what I get:

fmpro.getContainerStream("container").getClass()

class com.prosc.fmkit.types.FMBinary$FMContainerInputStream

FMBinary is not an InputStream subclass itself, but it contains a class called FMContainerInputStream, which is what you're getting. FMContainerInputStream is a subclass of InputStream, and the $ sign shows that FMContainerInputStream is a class contained inside the FMBinary class.

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