Jump to content
Server Maintenance This Week. ×

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


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

Recommended Posts

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

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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? 

Link to comment
Share on other sites

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.






 

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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