St3v1e Posted February 6, 2020 Posted February 6, 2020 Hi, As a complete novice to FMP, I'm attempting my very first database. We rely on storing our contracts on Google & Dropbox. I've been trying to either embed the pdf's into a "tab", or (my preferred option) to have an "Add URL" button to link to the online pdf. I tried adding a field and copying and pasting the URL, but it's not clickable, and I'd need to add another field for each pdf/contract. Is there a better more efficient way to do this? Thanks Steve
St3v1e Posted February 7, 2020 Author Posted February 7, 2020 . . . Hi, is this the correct place to post this question? Thanks.
Wim Decorte Posted February 7, 2020 Posted February 7, 2020 Yes it is. Can you tell us a little more about the "clickable" that you are after? I assume you store the URL in a regular text field?
St3v1e Posted February 7, 2020 Author Posted February 7, 2020 (edited) Hi Wim, Thanks for your reply - we've been using Podio as our "contacts CRM/database" for a couple of year's but have become despondent with it for various reasons. In that system, we had the facility to "add a document". Clicking on "Add Document" produced a new field, into which we could add the URL of the Google pdf/pdf we needed to locate from within that contact's information sheet. The URL was then "clickable" so as to allow one-click access to our document via the default browser. Is it possible to make a button to do something similar in FMP 18? Hope that makes sense? Edited February 7, 2020 by St3v1e
Wim Decorte Posted February 7, 2020 Posted February 7, 2020 If you want the user to be able to open that URL in a browser, just add a button next to the URL field (or make the field a button) that uses the "Open URL" script step, using the value of the field.
St3v1e Posted February 7, 2020 Author Posted February 7, 2020 Thanks Wim, OK I'll check that out, thanks. We add pdf's, Google Docs to these contacts frequently, and so these fields need to be created regularly - is there a method by which I can simply Click a button to add a field with these attributes already included. The objective is to click an "add Document" button, which produces an additional field, into which I can add the URL, which will link to the URL/Doc when clicked inside the contact window? Usually we have no more than 8-10 of these per contact, so it's easy to allow space on one side of the contact area.
Wim Decorte Posted February 7, 2020 Posted February 7, 2020 The documents should be its own table, related to the contact by the contact ID so that you can attach an unlimited number of documents per contact (even if you don't need a very high number: you do not want to create document fields in the contacts table). The "add a document" button would then fire a script to take the user's input and create a new related documents record. 1
St3v1e Posted February 7, 2020 Author Posted February 7, 2020 Thanks again Wim, Lots to research for me here, but I understand the principle idea. As I mentioned, I'm a total newbie to FMP and have not yet learned how to insert scripts, but will try to use your suggestions and learn the process.
Wim Decorte Posted February 7, 2020 Posted February 7, 2020 No problem. Come back with any and all questions, we all had to go through the initial learning curve at some point.
St3v1e Posted February 8, 2020 Author Posted February 8, 2020 (edited) Wim, After several hours, I've managed to figure out how to set the button to trigger a script to open a URL I've entered into the field adjacent to it. But I'm struggling to work out the 2nd part of the issue: How to make the button create a new field/button with the attributes I need. I'm anticipating the "Add New Document" button would perform like so: Click the "Add New Document" button Script performs the following: If the field above is empty (ie: no text) show me a dialog "Enter URL into empty field". Add new field to database (if new button & text field are created, if not ignore). Makes new button & text field directly below the previous one. If there's a URL (text) already entered in the field, make new button & text field directly below to replicate the previous button, with the same attributes (ie: Open URL button linked to new field). When a new URL is entered, assign it to the adjacent button, but allow me to name the URL independently When completed, each button (icon to the left) when clicked, should open the link to the relevant document (usually in google Docs). I know all this is possible with Applescript, but Is this is possible in FMP 18? Thanks for any guidance to Tutorials or help you may be able to provide. Example: Edited February 8, 2020 by St3v1e
comment Posted February 8, 2020 Posted February 8, 2020 It is not possible to add new fields to a database programmatically. Or add objects, such as buttons, to a layout. What you can (and should) do is add a record in a related table for each document linked to the current contact. This can be done directly by entering data in a portal (provided creation of related records is allowed in the relationship's definition) or by a script. The same portal can also display a button in each populated row. 1
St3v1e Posted February 8, 2020 Author Posted February 8, 2020 (edited) Thanks for your reply comment. The "Add New Document" button references a table by the same name, and the "pdf" buttons to the right, also reference fields within that table. I also have a 2nd table "Contacts" within the same layout. Could you be a little more specific about entering the data into a "portal". How would that be done? Edited February 8, 2020 by St3v1e
comment Posted February 8, 2020 Posted February 8, 2020 1 hour ago, St3v1e said: What am I misunderstanding here? I am not sure. Perhaps the meaning of "programmatically"? Every solution has a schema part and a data part. The schema part includes tables, fields, relationships, layouts, scripts, etc. Ideally, the developer would devise a schema that can handle any and all data that the users will create. But you are asking for a script that would add to the schema - and that's not possible. You need to find a way to add new documents as data.
comment Posted February 8, 2020 Posted February 8, 2020 (edited) Sorry, I did not see your edit before posting. Have a look at the attached demo. To add a new document, just type into the first empty row of the portal. Portal.fmp12 Edited February 8, 2020 by comment
St3v1e Posted February 9, 2020 Author Posted February 9, 2020 Hi comment, many thanks for the example. Looks very useable. Is FMP 18 able to utilise Applescript scripts?
comment Posted February 9, 2020 Posted February 9, 2020 (edited) 2 hours ago, St3v1e said: Is FMP 18 able to utilise Applescript scripts? Filemaker's support of AppleScript has not changed since version 6, I think (possibly even earlier). Do you have a specific task in mind? Edited February 9, 2020 by comment
St3v1e Posted February 10, 2020 Author Posted February 10, 2020 Quote It is not possible to add new fields to a database programmatically. Or add objects, such as buttons, to a layout. Just wondering if an Applescript can be written for the "Add New Document" situation?
comment Posted February 10, 2020 Posted February 10, 2020 (edited) Yes. If you have the necessary data, then AppleScript can tell Filemaker to go to the Documents layout, create a new record and set the ContactID, Description and URL fields with values. Edited February 10, 2020 by comment
St3v1e Posted February 11, 2020 Author Posted February 11, 2020 Many thanks, I have an Applescript Developer who may be able to help with the scripting. One other question, I'm confused about the portal window & inserting it into an existing layout. After making sure there's at least some info in the fields of the other table I want to insert, the window shows nothing. I can do a search on these forums, but happy to receive any comments you'd care to make. Thanks
comment Posted February 11, 2020 Posted February 11, 2020 Sorry, I am not going to guess what's wrong with a file I cannot see. You have a working file, see if you can spot the difference. If not, post a copy of your file (preferably minimized to only what's necessary to show the problem).
Wim Decorte Posted February 11, 2020 Posted February 11, 2020 12 hours ago, St3v1e said: I have an Applescript Developer who may be able to help with the scripting. If the user is already in FM when that piece of the workflow starts then it doesn't make sense to do this in AppleScript just because you have an AppleScript developer. This would be the time to push through and figure out how to make this all work in FM. 1
St3v1e Posted February 11, 2020 Author Posted February 11, 2020 Comment: Fair response, I have tried to figure this out, but in between work, family, kids and health, my time is limited to work on these issues. For now I'll have to use the file as-is and hopefully figure it out using a test file. Appreciate your reply. Wim: Ditto my comments above. But Comment said: Quote It is not possible to add new fields to a database programmatically. Or add objects, such as buttons, to a layout. However, my Developer said it can be done using an Applescript inside of FMP, so if it can't be done just using FMP, alone - why wouldn't I want to utilize his help to achieve the desired result? Time is not on my side just now, hence why I joined this forum - to try to fastrack to a point where I can get things running to some level.
comment Posted February 11, 2020 Posted February 11, 2020 48 minutes ago, St3v1e said: my Developer said it can be done using an Applescript inside of FMP, No, it cannot. Well, in theory, you could program the AppleScript to perform a developer's role by mimicking key presses and mouse movements - but I don't think you would get very far with this in practice. 1
St3v1e Posted February 11, 2020 Author Posted February 11, 2020 OK thanks again for the help in getting started. All very much appreciated.
LaRetta Posted February 11, 2020 Posted February 11, 2020 Hi Steve, you've been receiving advice from two of the top Developers and their suggestions are sound. Using a portal with related records is a VERY SIMPLE technique and process once you grasp the concept. I highly suggest you just take a few moments to understand how a relationship works by reviewing Comment's file. It would take far less time and effort than using AppleScript and it is a basic understanding of FileMaker. I wish you well on your project. 🙂
comment Posted February 11, 2020 Posted February 11, 2020 I should add that there is a way to add fields programmatically, using ODBC. However, the real question here is not "can it be done", but rather "should it be done". And the answer is categorically no. Having a field (or more precisely, a set of fields) for each document would be very poor structure. Just consider, for example, what would it take to find contacts with a specific document type.
St3v1e Posted February 12, 2020 Author Posted February 12, 2020 Thanks LaRetta/Comment - I'm considering the situation as per your remarks - Comment: Never having done this previously, I'm anticipating the place to start would be a good old piece of paper to map what I need and how it might all come together? Then move forwards, start building piece by piece, table by table, workspace by workspace? Is that type of process recommended (before I get too far in)?
comment Posted February 12, 2020 Posted February 12, 2020 Yes. I thought you had this worked out already, but you should definitely start with an ERD.
Recommended Posts
This topic is 2005 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 accountSign in
Already have an account? Sign in here.
Sign In Now