9 Replies Latest reply on Feb 24, 2011 10:29 AM by philmodjunk

    Why wont this work? Please help me.

    Stuee

      Title

      Why wont this work? Please help me.

      Post

      Hi, ive only jsut started using using FM and think ive worked out some bits ok, im just stuck on my orders page that the lines wont auto put in the info from another form in the relationship.

      Ive looked around and cant find info so ive hit a brick wall. If someone who's in the know which i now is allot around here could help i would greatly appreciate it.

      one more thing is, in the image box im trying to get so when i insert the image it auto copies the file to a folder on my hdd and names the file to the orderid and line, ie. c:\FMimages\BP1023_Line1_wedding photo2.jpg (orderid_lineinfo_orgiginalfilename.originalfileExtension)

      Like i siad im sort of new to all this so please dont say something that will go over my head, if you could change my file below so i can see and copy and learn for when i make the proper database.

      my test file here.

      www.beyondprinting.com.au/test.rar

        • 1. Re: Why wont this work? Please help me.
          philmodjunk

          Here's an invoicing demo file created by Comment and uploaded to a different Filemaker forum that you can download and examine. It demonstrates the lookup capability you are asking for. Check out how the tables are related, how the layouts are designed and also go to Manage | Database | Fields and double click the fields to see how field options have been specified to look up price and other data from the Products table.

          http://fmforums.com/forum/showpost.php?post/309136/

          one more thing is, in the image box im trying to get so when i insert the image it auto copies the file to a folder on my hdd and names the file to the orderid and line, ie. c:\FMimages\BP1023_Line1_wedding photo2.jpg (orderid_lineinfo_orgiginalfilename.originalfileExtension)

          This can be done, but I don't think I can tell you how to do it without also "going over your head". It'd be simpler just to insert the image into a container field using the Insert Picture command. You can insert a physical copy of the picture or you can insert a reference to the picture file's current location.

          • 2. Re: Why wont this work? Please help me.
            Stuee

            Thanks, ill have a look,

            Ok so you can try going over my head if you like, ill see if i can work it out, I tried making a script for off click event.

            What ive been trying to do is,

             

            On the container create scrips,

            Script

            Copy container content

            >

            Create folder name from OrderID number

            >

            Paste content into folder just created from orderid

            >

            Insert new image from image in order id folder.

             

            I jsut dont know the varibales as im guessing that is what i need to make this happen.

             

            • 3. Re: Why wont this work? Please help me.
              philmodjunk

              I need to know why you want to do this? Since the picture file already exists, why move a copy of this into another location?

              FileMaker cannot create folders. If you want to do that, you'll need to write an apple script (mac only) or use a file manipulation plug in (several are offered by third party developers).

              • 4. Re: Why wont this work? Please help me.
                Stuee

                I am designing this to use at a market im starting do do to place orders,

                My process,,

                A customer comes and orders say a puzzle, i create a order then get there phone or memory card in the computer then when in the order page still click the container, find which photo they want printed on the puzzle then select it, it then copies it and names it that order number then remove there media and they go off and shop the market then come back later to pickup.

                I have done one once and it was very busy and thats why i want to automate this and also i know which photo is for which order.

                 

                I could just create a folder in C:\market_images   then have whatever means i use to copy the file there and at the end of the day copy all the files to a manually dated folder, thats no problem, but i would like the file to be like BP1022_line1_orig filename.extension

                The extension could be pdf, till, jpg, gif so i cant keep it to just jpg.

                 

                Is this still possible.

                thanks for taking your time to help me.

                • 5. Re: Why wont this work? Please help me.
                  philmodjunk

                  Why not just have a container field on your layout, copy the image from their device to the appropriate folder (You can use the computer to create and name this folder however you want), then use Insert Picture to insert that picture file with store by reference enabled( to keep database file smaller), to link that picture to your order?

                  That way there's no need to copy the image to a different location each time. You can use the Database to track the location and filenames of each image.

                  And you can define one such container field for each line item record so you can link each line item directly to a specific image.

                  • 6. Re: Why wont this work? Please help me.
                    Stuee

                    i suppose that could work, is there a way to rename the file so at the start it says the order number and the cotainer name (i might call A for first image container and B and so on) so it will say BP1022_A_originalfilename.ext

                     

                    cheers

                    • 7. Re: Why wont this work? Please help me.
                      philmodjunk

                      You'll have just one container field, but many records with that container field so the container name won't help you here (they'd all have the same container name.)

                      Simplest method I can conceive of is to insert the image into the container field, but not by reference. (You could actually leave it like that and not have the copy separately loaded in you database--that's truly the simplest approach here.) To access the stored image, you can click on the image in the container and use Export Field Contents from the edit menu.

                      Usually, developers prefer to store images by reference so that their database file doesn't get so large. This script can take an image that was physically inserted in a container field, export it to a designated location and then re-insert it from that new location "by reference" so that it has stored your image in a specific place.

                      Set Variable [$Path ; If ( Abs ( Get ( SystemPlatform )) = 1; "filemac:/Images"; "filewin:/D:" ) & "/Images/Images " & Substitute ( Get (CurrentDate ) ; "/" ; "-" ) & "/" & LineItems::LineItemIDNumber & ".Jpeg"]
                      Export Field Contents [YourTable::yourContainerField ; "$Path" ] // don't put quotes around $path, filemaker adds that for you
                      Go To Field [YourTable::yourContainerField]
                      Insert Picture [reference ; "$Path"]

                      On a windows machine, this script exports the inserted image to Drive letter D: into a folder named with a name such as Images 2-23-2011 that is inside another folder named Images. On a Mac, the same line exports the file to a volume named Images where the same two folders are located. This demonstrates the two basic formats used for Mac and windows system. If you only have macs or only have windows, you can simplify the set variable step accordingly.

                      • 8. Re: Why wont this work? Please help me.
                        Stuee

                        Wow, that sort of makes sense.

                        Is there a way for it keep the original file name and just insert the job number and line number at the front? also how do i go about it exporting the file as original format as some files may be PDF.

                        • 9. Re: Why wont this work? Please help me.
                          philmodjunk

                          If these aren't always pictures, you'll need to use File, instead of insert picture--at least for the PDF's.

                          When you use Insert Picture or Insert File to insert a file the filename is also inserted into the file.

                          If store by reference was not used to insert the file,

                          YourTable::JobNumber & YourTable::LineNumber & YourTable::YourContainerField

                          Could produce the new file name.

                          PS. It's very helpful to be able to see the text data stored in a container field as a way to debug issues during design and testing. If you define a calculation field set to return text and simply refer to the container field by name in the calculation, you can place this field on a layout next to the container field so that you can see the actual text stored in the container field.