Import Folder of Documents into Container field via script - containers

Im running Filemaker Server 19 and FileMaker 19 client
I have an app that manages Document Templates, ie Word documents
Each Document Template master record contains information about that template, plus connects to a Document Samples table that contains one Word document (the template) and one PDF document (an output of the template file when used , a bit like mail merge).
We've recently had an update to the system I support (not a Filemaker system) and many hundreds of the Word templates have been updated. If I have to do one or two in a session it's pretty simple to drag the latest version of each template to the Container field; but recently I've been having to do 10s/100s of Document updates very quickly to get them into our system. I've put copies of all the Word documents into a folder on my Mac. They all have a unique name and a unique template id in the format of 1234doctemplate01. So, the 1234 equates to my Document template ID in my database and the filename is also mirrored in a 'Template Name' field in the database.
So, my question is how to build a Script to go through the database one record at a time and, for each, to check the Mac folder and see if there's matching document name and, if there is, to paste/copy it into the appropriate Container field
Can anyone advise, please? Further detail available if this isn't too clear

I would do something slightly different:
Import all the files in the folder into a new table (see https://help.claris.com/en/pro-help/content/importing-folder.html) and create a relationship between this table and your existing table, based on matching template ID or name.
Then you can loop over the records in either table and if a match is found, replace the data in the existing container. Or perhaps you could make this a permanent structure, where the file is stored in a related record.
Doing it the way you have proposed would be awkward using only Filemaker's built-in tools (and outright impossible if the folder is not somewhere within the Documents folder). It might be somewhat easier if you use a plugin (e.g. BaseElements) to read the folder's contents.

You can use base element plugin to select multiple files in a folder with
BE_FileSelectDialog
or check if a file exist with
BE_FileExists
and then looping over the list to insert every file into a container via
set field ["your_container" ; BE_FileImport ( $file )]

Related

Load thousand files dynamically using SSIS

One folder is having thousand files and each files will be loaded to different sql server tables. How to design a SSIS package to do the task ?
For ex:
File name: Location_12345.xlsx will be loaded into Location table
Employee_1233.txt will be loaded into Employee table
Department_123456.csv will be loaded into Department table
The answer is yes you can. Loop through the files in the folder and get whatever you need. A simple google search would give you everything you need. For example here
You will need a package for each flow. You defined a minimum of 3 in your question.
For example, if all Locations follow the same flow then:
Add a foreach and choose files to loop through.
Define the folder
Define the criteria (Location*.xlsx)
Set the full file path to a variable
Add an excel connection
Make an expression for that variable
Design your data flow.
Delay validation on Excel Source before running.
This is a sample. You will have to do this for each file type.

Multiple entries containing exact file paths or text file on server containing multiple file paths with a single entry in the database to that file?

Here's some background information to help understand my dilemma. I've got a system written in PHP where users can fill out a form, upload a few images and everything gets archived in a .zip, I then have an "Account Page" that echo's a simple table containing a list of all of that specific users uploaded .zip's, the reason I'd need separate filepaths for each and every .zip is because no matter the user, they all need to be in the same single folder on the server for the broader application to work (these .zips are used for a mobile based Package Manager; see Cydia).
Would the smarter choice be to have every name of each .zip stored in a table on the database with things like the username and user_id tying to each entry, which would result in a few entries being for one user, and a few more being for a different user (depending on upload time), and everything will be unorganized. If I need to enter the database and manually search for a specific user's uploaded .zip's, I'll have to sort them out by user_id.
OR
Would it be more cost effective (in terms of passing data and hardware limitations) to have an XML file or even a plain .txt file on the server with a list of the users uploaded .zip's, and an exact file path pointing to them, and in the database simply have one column tied to the rest of the users information that points to that file containing multiple lines of filepaths?
It's a mouth full I know, and I have no problem achieving either of them as it's well within my skillset and knowledge of PHP & MySQL, I'm just not too sure which is the most secure and the best practice in the industry for this type of system.

Watson Conversation dialog for large number of entities?

I currently have a chat bot that has an entity for each stock symbol. There are over 3,000. For my dialog I want to be able to detect questions like #get #price #stockSymbol. Is there a way to deal with a large number of entities without writing an if statement for each one?
You are only allowed to have 100 entities in a single workspace. However those entities can have 100,000 values.
So you could create an entity called #StockSymbol and then each value would be the Stock identifier (eg. IBM).
So you would only need one IF statement to determine it is a stock, then pass back the entity information to your calling application to take action on the value.
To put this in programatically, if it is a one time thing you can create a CSV file like the following:
StockSymbol,IBM
StockSymbol,MSFT
StockSymbol,APPL
and so on. Then import that entity file. Alternatively you can use the workspace API to update an already deployed workspace.
I am sorry to say there is no process within the Conversation Service UI that has an automatic dialog creation method. In cases like this, many teams create an external script that can read a file with your entities in it, and then creates a workspace json file with the required dialog nodes. The workspace json file is a relatively simple format, and I have found you can easy merge any new json file into an already created workspace. In fact with the new API's it even possible to load the new elements into a running workspace. ( although if new to this, create a duplicate ws, and merge into this one, or download and merge via a good editor. )

Copy folder contents into Access database

I was wondering if anyone might know how to import the contents of a folder into a Access table.
I have a database that's used to make ID cards for students with a unique ID. When students get their photos taken to be printed on these cards, the files are saved as jpegs with the student ID numbers as the filename. (E.g., student 1234567's photo would be saved as 1234567.jpg.) These photos are all saved in the same folder.
I would like to be able to have Access (or a script) automatically generate a table for this folder with two columns: the filename and the image (as a BLOB). That way, I would be able to add a student's photo to his or her data record with a simple SQL query.
My VBA skills are not great (I'm in the process of learning), so any help would be appreciated. Thanks!
There is an MS article: http://support.microsoft.com/kb/103257, however, with the recent version of Access (2010), you would be better to consider the attachment data type which will also allow you to display the photo on a form.

csv file upload

In my Grails app, I would like admin users to be able to upload a CSV file that contains data such as:
List of users to be added to system
List of groups to be added to system
Assignment of users to groups
I have no idea how the user will generate these CSV files - most likely from Excel, Access or similar, and therefore I've no way of knowing which column will contain which data. So I'm planning to allow the user to specify which column contains users, groups, etc.
I'm wondering if there's a JavaScript component that could help with this. Ideally I'd like to implement the following:
User uploads file
In browser, user is shown first N lines of uploaded file and prompted to select the column that contains the users, groups, etc.
Column information is uploaded to server
Is there a client/server side component that could help with this, or an entirely different approach which would be superior to that outlined above?
I should emphasise that the users of this system will not be technically gifted, so expecting them to provide an XML/JSON file instead is out of the question (and you can definitely forget about asking them to call a Web Service instead of uploading a file).
Thanks,
Don
I like your solution so far, given that the users are non-technical, and that you want to be able to accept this data as a file upload, rather than have the users enter it directly into your application.
I would simply suggest that when the user uploads the file, the server returns the first five (or so) lines back to the client as an HTML table. Then you can have <select> drop-downs as the headers for each column, with the pre-set options you're looking for. You can validate that the user has assigned all available options to each column (use JS to remove options from the select as they use them, but be sure to provide a method to undo and change selections), and allow some columns not to be labeled (which the server will just ignore when parsing the file.
If possible, also illustrate (perhaps in a graph format or just an example sentence, if applicable) how their label choices will apply to the relationships. For example, "New user ABC will be a member of new group XYZ." If ABC and XYZ are unexpectedly backwards, the user will recognize they made a mistake.
Also, some users will inevitably upload a file where they used rows as columns and columns as rows. Either provide a GUI function to reverse this ("rotate" the table), or let them choose which axis to label.
I would also suggest providing your users with a collection of example files in various formats (Excel, Access, etc), and give them explicit instructions for how to enter the data they want, and step by step instructions to export as CSV and upload.
I have no idea how the user will generate these CSV files - most likely from Excel, Access or similar, and therefore I've no way of knowing which column will contain which data.
I should emphasize that the users of this system will not be technically gifted
With these two things in mind, are you sure that CSV import is the best way to handle bulk user creation? It's a great technical solution, but the question is, will your users be able to take advantage of it?
It may be worth implementing an alternative bulk create option for those who don't get CSV or are scared off by Excel. Perhaps a JS grid that has the required fields where they could manually enter the data for each field and enter as many as they need at once, with a link to upload a CSV file as an option for those who would use it.
For the CSV option, since your users are not technically-minded, it would be better to give them instructions on how to create the csv files that specify the order fields should be in. Along with a screen shot and a sample file.
Another option is to require the field names be the first row of the document, and require that they use specific labels for the fields. If you do that, you could figure out from the first row what order the data is in. You could also put in a check that looks for the titles in the first row and if they're not found, tell the user they need to add the field names to the CSV and re-upload.