cruijff Posted February 25, 2013 Posted February 25, 2013 Hi guys! I'm hosting a database via FMS12 and I need to save some files as pdf, to be later sent via email and/or consulting. I need these files to be accessible from all client users and I was wondering how to achieve this. Pdf format is mandatory for me, how can I get the correct filepath to save a pdf on the server machine? I read there are some issues on this topic, can you help me please? I'm open to other solutions..is this achievable with container fields? Thank you very much!
bcooney Posted February 25, 2013 Posted February 25, 2013 "I need to save some files as pdf" -- what files? Do you mean, write a report script that creates a PDF? Yes, you can save them into containers so that they are accessible to all users - but couldn't they simply run the same report? Can you expand on the description of your requirement?
cruijff Posted February 25, 2013 Author Posted February 25, 2013 Thanks for the reply bcooney. My database produces Invoices/Order confirmations and stuff like that. I need to send these kind of documents to my customers and suppliers and I need them to be stored somewhere so that they all are consultable from client users.
Wim Decorte Posted February 25, 2013 Posted February 25, 2013 Is this a server-side script schedule or something that the users will execute? "save as pdf" is not a script step that is supported for server-side scripting. If it is user initiated action then yes, you can have your script produce the pdf and insert it into a container field.
cruijff Posted February 25, 2013 Author Posted February 25, 2013 There's a button with a script attached to produce the pdf document, so I assume it's a user initiated action. No way I can save a pdf on a server folder? I'm worried that storing these files on container fields could increase the database weight and will slow backups.
Wim Decorte Posted February 25, 2013 Posted February 25, 2013 Certainly you can store the file on the server. But that requires OS-level file sharing, user rights to that folder and a path to that folder that is the same for all users. So it is more of an OS configuration than a FM issue. Be very careful with OS file sharing on the FMS box, you do not want to accidentally expose your live files or your backups.
cruijff Posted February 25, 2013 Author Posted February 25, 2013 Ok thank you very much Wim! I'll try to set file sharing correctly on the server machine. Last question (I hope): How can I get a correct filepath for the server's shared folder from the client computer? Which of the "suggested" (see picture) filepath shall I chose? Thanks again
Wim Decorte Posted February 25, 2013 Posted February 25, 2013 Depends on the OS, are all clients on OSX? Then the filemac example. I would probably output the file to the local hard disk of the user and then try to move it to the share. That way the PDF will always be generated even if the network is down or otherwise inaccessible.
JerrySalem Posted February 25, 2013 Posted February 25, 2013 Your comment about using containers is not accurate. You can save the PDF's to a container field, save them to external containers. This won't increase the database size, it also will not slow the backups. It would seem much easier to script the PDF's to save to a container field. Then the users could email the PDF's directly from the database, or save them to the local drive. Jerry There's a button with a script attached to produce the pdf document, so I assume it's a user initiated action. No way I can save a pdf on a server folder? I'm worried that storing these files on container fields could increase the database weight and will slow backups.
bcooney Posted February 25, 2013 Posted February 25, 2013 I don't see the need to get into OS scripting and file shares. Why did you suggest this Wim? Are you interpreting "I need these files to be accessible from all client users and I was wondering how to achieve this." to mean non-FM client users? I question the need to save invoices as PDFs. The invoice is a record in the database, and should be locked from edit at some point.
Wim Decorte Posted February 26, 2013 Posted February 26, 2013 I did have the impression that the PDFs needed to be accessible from outside FM. I do agree with you that PDFs are not needed just to store a snapshot of the record in time. If the database has been designed ok the record data will reflect the static data.
cruijff Posted February 26, 2013 Author Posted February 26, 2013 I don't need the files to be accessible from outside FM, all users have a copy of FMpro. I'll try to go for the container field solution, since I have 2 osx users and 1 windows user.
Ralph Schwegler Posted February 26, 2013 Posted February 26, 2013 hi cruijff i had similar issues, and solved it. the script run every night and do some complex calculations, export the results which are directly imported in a report database. There the users can send an PDF email manually (I gave up the idea of sending that mail automatically). you might want to have have a look at those posts: http://fmforums.com/forum/topic/82704-server-side-schedules-globals/ http://fmforums.com/forum/topic/82834-server-scheduled-export-error-800/ http://fmforums.com/forum/topic/82485-perform-find-not-working-on-server-side-script/ Feel free to ask any comment on those, I can help!
cruijff Posted February 26, 2013 Author Posted February 26, 2013 Thank you Ralph. Even thou I don't want to make an automated server script (I don't need it) I'll certainly take a deep look at your posts, they'll certainly be useful to me.
cruijff Posted February 27, 2013 Author Posted February 27, 2013 Ok guys, I'm having a bit of trouble here. I read about remote containers (article "Remote Containers" by Wim Decorte & Steven H. Blackwell included) and I suspect this is the thing I need. I'll try to explain in detail what I'd like to achieve: I have a table named "Invoices", and for this table I have two layouts: "Invoices_layout" and "Invoices_pdf_layout". Of course "invoices_pdf_layout" is a pdf-like layout, whith a part "visible" in preview mode and a part cut off in preview mode. What I'd like to do , while sitting on "invoices_pdf_layout" is to execute a script (pressing a button) that saves as pdf the invoice and puts it in a container field on this same layout. Can I do this with remote containers, so that every user of the database can consult and/or send via email the pdf version of the invoice? Which script steps shall I use to save the invoice as pdf directly in the container folder (FMS)? Or do I have to save the file locally and then put it in the container field so that is gets saved on the server? Which script step allows me to insert a .pdf file in the container field? Thank you very much again.
Ralph Schwegler Posted February 27, 2013 Posted February 27, 2013 i'm not confident with remote containers, but i try to describe the steps the way i would make it: -on any client, create the pdf (i would include some details on the order confirmation, which could allow to retrace the info on a file basis) -automatically write it on the server, on a predefined path (path/year/monthnumber for instance) -create a record (in a separated table) of order confirmation creation, which holds the path to the just created pdf with the most important details in it -in that record, make a button to open the pdf in a separate viewer (preview, acrobat reader for instance) did i get the point? if yes does it make sense? cheers
bcooney Posted February 27, 2013 Posted February 27, 2013 Here's a demo done a while ago in FM11 to illustrate emailing a PDF, but should give you the tools to recreate in FM12. Again, saving a PDF of a record is not something you need, imho. Just run another PDF when you need it. What if the record has changed? The existing PDF will not represent the latest version of the record, and that is why I don't recommend it. InvoiceDemo2.fp7.zip
cruijff Posted February 28, 2013 Author Posted February 28, 2013 i'm not confident with remote containers, but i try to describe the steps the way i would make it: -on any client, create the pdf (i would include some details on the order confirmation, which could allow to retrace the info on a file basis) -automatically write it on the server, on a predefined path (path/year/monthnumber for instance) -create a record (in a separated table) of order confirmation creation, which holds the path to the just created pdf with the most important details in it -in that record, make a button to open the pdf in a separate viewer (preview, acrobat reader for instance) did i get the point? if yes does it make sense? cheers Yes Ralph, but I don't understand HOW to write it on the server..
cruijff Posted February 28, 2013 Author Posted February 28, 2013 Here's a demo done a while ago in FM11 to illustrate emailing a PDF, but should give you the tools to recreate in FM12. Again, saving a PDF of a record is not something you need, imho. Just run another PDF when you need it. What if the record has changed? The existing PDF will not represent the latest version of the record, and that is why I don't recommend it. Thank you bcooney, the file you posted will be really useful I understand your point about not needing a "snapshot pdf" but I'll try to give you an explanation: When I receive an order from a customer I fill my order layout with the data on the customer's order (let's say my customer orders 1000 pcs of product A). I send to my customer the pdf produced by "order entry pdf layout", i.e. order confirmation. If I am not able to ship the whole 1000 pcs and want to do a partial shipping I'll have to modify the order line item, i.e. modify the order. (While I'm writing I understand I should send another order confirmation to my customer, but I can't since the customer wants to keep track of our company's delays). Hence I need to have a snapshot of the order I received, saved as pdf. This does not apply to Invoices and/or purchasing orders which are never modified, but my db users asked me anyway to keep all the documents we produce saved as pdf if possible. I'm about to figure out how to achieve this, I'll post the solution I've come up with when done. Thank you guys
Wim Decorte Posted February 28, 2013 Posted February 28, 2013 i'm not confident with remote containers, but i try to describe the steps the way i would make it: -on any client, create the pdf (i would include some details on the order confirmation, which could allow to retrace the info on a file basis) -automatically write it on the server, on a predefined path (path/year/monthnumber for instance) -create a record (in a separated table) of order confirmation creation, which holds the path to the just created pdf with the most important details in it -in that record, make a button to open the pdf in a separate viewer (preview, acrobat reader for instance) did i get the point? if yes does it make sense? cheers No, you missed the point. If you use 12's new Remote Container data then you just insert the PDF into a container field. The container field itself needs to be set up to save its data externally. That's all. No need to figure out the path to the server, set up a share and all of that. The only caveat is that those externally saved file are only for access by FileMaker Server. You should never try to access them outside of FM.
bcooney Posted February 28, 2013 Posted February 28, 2013 "If I am not able to ship the whole 1000 pcs and want to do a partial shipping I'll have to modify the order line item, i.e. modify the order." Do you have Shipments as an entity related to orders?
cruijff Posted February 28, 2013 Author Posted February 28, 2013 @bcooney I guess the answer to your question is yes: my "Orders line items" table has a field named date due, and line items are linked in a calendar to keep track of shipping dates. Am I doing something wrong?
bcooney Posted February 28, 2013 Posted February 28, 2013 Nothing wrong, just not as granular as you could go. If an order can have multiple shipments, then you need a shipment table, with shipment line items. You could "share" the order line item table by having a _kF_ShipmentID in the line item table. Do you split order line items across shipments?
Wim Decorte Posted February 28, 2013 Posted February 28, 2013 If I am not able to ship the whole 1000 pcs and want to do a partial shipping I'll have to modify the order line item, i.e. modify the order. I do think this is wrong. An order is an order, a shipment is another entity that just happens to be related to your order. The order itself should never be modified for shipping reasons. I would revisit that design for sure.
Recommended Posts
This topic is 4538 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