September 14, 201015 yr Newbies 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
September 14, 201015 yr 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 September 14, 201015 yr by Guest
September 14, 201015 yr Author Newbies 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é
September 14, 201015 yr 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).
September 14, 201015 yr actually I have a question: what is the exact object returned by the method getContainerStream?
September 16, 201015 yr Author Newbies 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?
September 16, 201015 yr no you can access the filemaker calculation engine, so you already have access to the GetField () function.
September 23, 201015 yr 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'
September 24, 201015 yr 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
September 24, 201015 yr 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.
Create an account or sign in to comment