Jump to content

File path of REMOTE data storage


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

Recommended Posts

Our container field has the images stored on the server, external to the database ( [hosted location]/DBIMages ) so as not to bloat the DB itself.

Some times the image is too small to view within the database in its normal layout, so I wanted to use the SEND EVENT to open the image so the User can see it full screen and then just close that application when they have finished.

The SEND EVENT works fine if I hard code a file name with full path, but I am having trouble using a variable to store the file name and path because the filename is being passed as "REMOTE: " + the file file and the SEND EVENT does not recognise the REMOTE designation.

How can I specify the full file path and filename?

TIA

Link to comment
Share on other sites

Thank you for the suggestion - did not know about popever as a button option.  So this could be used with the script trigger set to run a script that uses a Send Event to open a image editor program, but the issue remains -  the file path - knowing how to specify this.  The file is Remote

Edited by chris7of9
clarification
Link to comment
Share on other sites

bcooney - Many thanks.  The PopOver (using a field button in the popover) is a solution as the part of the file that we need to see is visible.

2 Issues with the solution -

1. The popover does not have primary focus, so the field in the portal (in which the popover has been placed) covers the lower left part of the popover expanded image - I have tried playing witht he settings, but cannot seem to get the popover to have focus.

2. I would still like to be able to specify the full path that is in the  REMOTE::/DBImage  directory - REMOTE is the unrecognised, but is designated by Filemaker.

 

Link to comment
Share on other sites

The data is held on the server- so how do I identify the storage path?  I can export the image, save it and then open it in a program, but that is what I want a double-click to do for the User, but we cannot do it, as we cannot specify the full file path.  As am interim resolution of the problem, the popover works sufficiently well.

The STORAGE path for the field is [hosted location]/DBImages

How do I specify the [hosted location] as part of the full file path and capture it as a variable to be able to use it in a SEND EVENT - this is needed to export the image to a picture editing program that would open full screen for the user to fully manipulate the image and then close once used?

 

 

Link to comment
Share on other sites

18 hours ago, bcooney said:

How are you doing this? Can you post the script?

Manually - Right click to get export option etc.

What Filemaker needs is makro recorder that then enables you to automate ones actions!

Link to comment
Share on other sites

59 minutes ago, bcooney said:

Do you know how to write a script? That's the "macro recorder" in FileMaker. 

here's a demo. However, editing a file outside of FileMaker will require the user to reinsert the file. You cannot directly edit a container file stored in FM.

DemoContainer.fmp12 1.14 MB · 0 downloads

Script writer in FileMaker is exactly that, it is not a dynamic recorder of manual actions that converts those actions into a script - macro recorder, which other programs have.

Yes, I know how to write a script, but the specifics of what is required for this script is beyond me and it would appear everyone I have asked.  e.g. what should be a simple "capture the double click event" is impossible in Filemaker, and trying to do a loop to capture one click based on the time in milliseconds is also not possible as the variable that is required, cannot be captured and therefore cannot be used from an on trigger event - all things I have looked at.  Hence your Idea of using the popover, is very useful, it is a partial solution but does not resolve the underlying issue of - How does one capture or designate the remote file path of a record that has been stored in a container field?

The Demo that you have sent illustrates a container field being opened in another program - as it cannot be browsed, the way it works I am assuming it is using a container field with an image that is embedded in the database (i.e. it is not stored external to the database) and you have used an SEND EVENT to simply open the file.   Thanks, but that is not applicable to my question as the image path is not an issue.

Below is an example of one attempt. Otherwise with different path specified i get an error message "Container field cannot be exported"

Thanks for trying to help

ExportImageProblem.png

Link to comment
Share on other sites

Externally stored containers can be treated as if they are embedded. There is no need for send event. Do you see the export script and how I set the path? You are set on  supporting a double click. Can a user click a button that exports instead, as I have in demo? 

Link to comment
Share on other sites

9 minutes ago, bcooney said:

Externally stored containers can be treated as if they are embedded. There is no need for send event. Do you see the export script and how I set the path? You are set on  supporting a double click. Can a user click a button that exports instead, as I have in demo? 

Sorry, must have downloaded your demo incorrectly before - now your script is viewable - will review. thanks

Edited by chris7of9
comment is incorrect
Link to comment
Share on other sites

19 minutes ago, bcooney said:

Externally stored containers can be treated as if they are embedded. There is no need for send event. Do you see the export script and how I set the path? You are set on  supporting a double click. Can a user click a button that exports instead, as I have in demo? 

It is the designation of the external path that is causing the issue - as I cannot designate it.

In your sample file, you know that the Secure Storage path is Item::Image and then the file name - in your example MyImage.png.  However, when the storage is External Open - see attached screen shot - where the file is Relative to [hosted location]/TISDBImages - I cannot designate the [hosted location] part of the file path.

100% I am missing something, which hopefully the light will come on in my brain and I will see the error - but it eludes me at present.

 

ExportImageProblem1.png

ExportImageProblem2.png

Link to comment
Share on other sites

From the Data Viewer (I have blanked out the clients name M) I can see the selected image has more than just the file name.

The external Storage should be saving the file name as - Client::name_Second & " " & Client::Client_No & " " & DBDocumentSelected::Description which for this record is M........ 5253 Passport, but I see that it has other file information  e.g. remote:Passport.jpg size:2858,2043 JPEG:

Is this additional file information that the system is generating what is causing the problem?

ExportImageProblem4.png.2b7151074dde9428b38d718dfbe58f8e.png

Link to comment
Share on other sites

You will have to sanitize all user entry fields to strip any illegal characters. Also because you're server is on Windows you should use a terse filename and paths as there is a hard limit for number of characters in a windows file path.

There is no reason to organize the the directory structure for external files. As you should never be touching these files via the OS.

I typically have a creation timestamp that I convert to a folder path as this

YYYY/MM/DD/UUIDofRecord/file.ext

or keep it simple and use Secure Storage.

 

Link to comment
Share on other sites

2 hours ago, Ocean West said:

You will have to sanitize all user entry fields to strip any illegal characters. Also because you're server is on Windows you should use a terse filename and paths as there is a hard limit for number of characters in a windows file path.

There is no reason to organize the the directory structure for external files. As you should never be touching these files via the OS.

I typically have a creation timestamp that I convert to a folder path as this

YYYY/MM/DD/UUIDofRecord/file.ext

or keep it simple and use Secure Storage.

 

Sorry, but this is as clear as mud.  Any "Illegal" characters are system generated, so i have no control.  What is a terse filename - Windows filename length has never been an issue for us.  Your suggestion of a timestamp for the file name makes no sense - how would one identify what it relates to - backup restore is a MUST, so irrelevant names makes no sense, unless you can clarify its use.  Secure Storage has the same issues when discussing backup restore or moving from a server.

Link to comment
Share on other sites

Client::name_Second & " " & Client::Client_No & " " & DBDocumentSelected::Description 

These are fully qualified field names concatenated with spaces that are entered by your users or by your system if someone copied and pasted text in or enter illegal characters these are being used for the remote container path. A field could contain a novel in a 'description' field that will fail to allow you to create a folder path for the container to store at the OS level. - humbly this is the wrong approach.

If your restoring from a backup you restore your entire database directory including all secure remote data and all.

An alternative solution would be to use SuperContainer and then you are only storing a URL in your database. If you need to 'send' your client a document you can just send them the URL for viewing (provided you have public dns name to server)  and not have to export and send the actual document - I am doing this extensively where end users can see their document, by clicking a link - it has also reduced mail spam because pdf attachments can be erroneously flagged by spam by some email providers. 

 

 

Link to comment
Share on other sites

The path name is fine - the name and client number have been previously entered and/ or system generated and the description is prefilled based on a dropdown list that cannot be edited, so no spurious characters.  Thanks, but that is not the focus of the problem.

Secure storage encrypts the data, so whilst the database knows where it is saved and its reference, the DBA does not explicitly, hence Extrenal Opern Storage is a "safer" option for us.

By having the images stored EXTERNAL to the database, is just saving the URL in the database with the Image in the REMOTE directory, keeping the overall size of the database small, relatively. 

What is a SuperContainer - as I can find no reference in FileMaker Help?

We are not sending the file or image anywhere, we are just trying to enable the User to view the image much larger than the popover allows and was my first thought to be able to expand the image, simply using a SEND EVENT to the Windows default image editor program, which opens the image full screen - this works fine, if the image is embedded in the database, but not if held remote.  This is what the original question to this thread is about - how to specify the REMOTE path to be able to use the SEND EVENT in the same manner.

 

Link to comment
Share on other sites

You can act as if the image is embedded. FileMaker handles the path. Just reference the container field. I agree that the export path should be set by script and not be concatenated user entered fields. Try it. Use the demo I posted and change to external storage. Also, I usually export to the temp directory as that’ll be cleared when you quit FileMaker, get ( TemporaryPath ). 
 

fyi supercontainer is a product by 360works and was popular before external storage was native. Still has its uses. 

Link to comment
Share on other sites

Do not use SEND EVENT you can use the Script Step: Export Field Contents

You simply do not need to manage remote container storage at all either use the default path or append  to it such as:

Screen Shot 2021-11-23 at 5.25.25 PM.png

You must end in a closing slash you don't include the file name only the PATH to the file:

FileName/Table/Field/ is the directory that FileMaker assumes

The ID could be your customer ID or some other identifier if it is a Customer Id all the files for that customer will find itself in that folder path. if they upload multiple files with the same name FileMaker will Handle that and happen a -1 -2 to each duplicate file in the directory. 

Link to comment
Share on other sites

37 minutes ago, bcooney said:

Yes, you don’t need the path. Try it using the demo. 

Sorry, I cant get my head around this.  Your demo has the external storage Set Field specified as "Item::Image" - this is the bit I cannot fathom what to change it to, as my DB uses "Client::name_second" & "_" & Client::ID"  and I cannot add justthis as it requires a field to be specified, so the image editor opens BLANK.

PS. I now have the popover working correctly - had some unknown glitch that after deleting and redoing it, the popover now opens correctly to the right of the field and is no longer partially obscured (so once again thanks for that simple but useful solution)

 

image.png.480f1837f99aac9b7ff50f565f9e19a4.png

Link to comment
Share on other sites

ok, let’s start again. There are two paths to manage:

1. the path at which the image is stored on the server and

2. a path you’ll set for exporting the image from FileMaker. 

For 1, the storage path, Stephen suggested a convention that’ll produce a clean, sortable path using a time stamp and record primary key 

For 2, I’ve told you to use $path = get(temporarypath) & $filename. $filename can be anything. It doesn’t matter. It’s temporary. I also am telling you that you don’t need to know where the storage path is to export a container. FileMaker will get it. Just specify the container field you’re exporting from. 

  • Thanks 1
Link to comment
Share on other sites

11 hours ago, bcooney said:

ok, let’s start again. There are two paths to manage:

1. the path at which the image is stored on the server and

2. a path you’ll set for exporting the image from FileMaker. 

For 1, the storage path, Stephen suggested a convention that’ll produce a clean, sortable path using a time stamp and record primary key 

For 2, I’ve told you to use $path = get(temporarypath) & $filename. $filename can be anything. It doesn’t matter. It’s temporary. I also am telling you that you don’t need to know where the storage path is to export a container. FileMaker will get it. Just specify the container field you’re exporting from. 

Ok - pure rookie errors, but i understand now - So 10/10 for persisting with my ignorance.   Your help is much appreciated.

Notes to self - :

1. When in doubt - delete coding/scripts and start from scratch, because if the original has more than 1 error, it is not easily found.

2. Know that if a Moderator says i am wrong - 100% this is confirming I have missed something in the logic or not explained the issue adequately - so review.

 

FYI :-

1. There was/is no issue with the the variable path I chose to use to output the file to - it was simply easier to navigate to C:/temp/ and see the file was being generated and stored, albeit on  temporary basis, rather than delve down the User/dataApp/etc/etc path.

2. When the output was blank, it was when I changed the script and did not specify a name for the output file, thinking the actual file name would be used, but wasnt ), hence my note 1 to self.

 

Now it is working, I can play with the output and have an option for the User to E-mail the selected image from the portal.

Link to comment
Share on other sites

Good news! So hard to get past preconceived notions, right? When testing I use get(DeskTopPath), then switch to get(Temporarypath). 
 

ah, now the email challenge begins.  You can simply specify $path in the send email attachment. However, I would encourage you to consider moving away from smtp and look to api email ( SendGrid, MS Graph).

Link to comment
Share on other sites

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