Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Script that downloads the file associated with the button clicked on???

Featured Replies

Hello!    I have written scripts to download when the button is clicked that it will download the file associated with that button.  HOWEVER, is there a simple way to write a script to simple download the file associated with a button pushed, instead of writing a script for each button, will be over 50!!!

A user can only click on button at a time, and each button has its own container field.  I put a screen shot of the menu they will see, and a copy of the script I am using per button.  

Could I just have a general script to start once the button is pushed to get the name of the button and then download that file associated with it?????

Thanks a million!!!

Screen Shot 2021-08-30 at 10.36.30 AM.png

Screen Shot 2021-08-30 at 10.38.45 AM.png

I would suggest you place the files in a related table, where each one will be an individual record. Then show them in a portal (or, going by your screenshots, in portals). Then your script, when called by a button placed in a portal, will export the field of the record shown in that portal row.

I believe you will find this structure more convenient for other purposes as well.

 

 

  • Author

I would rather keep them in this table, since that is basically what it is.  All this FM database does is lets one person upload files from one layout and then other people download files from another layout.  I would like to capture the name of the button they click on, and then from there download the file associated with it.

 

I am wondering if the Get ( ActiveFieldTableName ) would work? 

22 minutes ago, 1FilemakerMan said:

I would like to capture the name of the button they click on

When you say the name of the button, you actually mean the label of the button - do you not? 

  • Author
39 minutes ago, comment said:

When you say the name of the button, you actually mean the label of the button - do you not? 

Button or label.  They will be clicking one of the four  Container Buttons to download the item.

I am fooling around with something like this right now.  But it is not seeing the object in the container field to download. It just creates a text file.






 

  • Author

There has to be a simple way that on click it simply starts to download the contents of the "Container Field" clicked on.

 

3 minutes ago, 1FilemakerMan said:

There has to be a simple way that on click it simply starts to download the contents of the "Container Field" clicked on.

No, there is not. And there is a good reason why there isn't. Filemaker is a relational database. Having 50 "alike" fields violates database normalization. Filemaker does offer you a simple way to accomplish your goal by using records instead of fields - as I already suggested in my first reply. To do it with 50 fields, you will need 50 scripts. Or assign each button a script parameter and add 50 If[] steps to your script.

Note that you could use an OnObjectEnter script trigger instead of making the field a button. But that would be sub-standard UI. And letting users into the field, even for a short instant, could have undesirable side effects.

 

  • Author

Ok, will I think I will look into doing it the way you suggested.  I could then display the fields in a related table try it that way.  You are very much way better at this program than I will ever be.  I will work on moving things over to another table.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.