7 Replies Latest reply on Mar 25, 2017 1:39 PM by JPetersen

    Replace Container Field Contents with User Selection

    JPetersen

      System: Filemaker 11 and Filemaker 10 Advanced on a PowerMac G5

       

      I have some small thumbnail pics embedded in each record. Let's call the container fields PicA PicB PicC PicD.

       

      There is a second layout where the user-selected thumbnail is shown as a grid in preview mode (it selects PicA OR PicB OR PicC from each record and lays them out in rows and columns) so the user can compare all the PicA or all the PicB, etc., in Preview mode.

       

      [ Record 1 PicA]   [Record 2 PicA]   [ Record 3 PicA]   [Record 4 PicA] 

      [ Record 5 PicA]   [Record 6 PicA]   [ Record 7 PicA]   [Record 8 PicA]  etc.

       

      I use a generic container field PicUsersChoice on the grid layout.

       

      I can prompt the user for which Pic is desired, let's say the user selects D (this is stored as a variable).

       

      I can use a calculation to turn it into the field name PicD and then I'm stuck.

       

      I've tried every function I can find in the script steps and calculation steps and I am careful that the result of the calculation is "Container" (I've tried it other ways also) and the best I get is that "PicD" (instead of the container contents) being inserted into PicUsersChoice. I don't want the name of the pic field inserted into the PicUsersChoice container, I want the container contents inserted (the pics).

       

       

      Using export and import to manage the pic files is overkill. The user may be flipping constantly between PicA and PicC, etc., and it doesn't make sense to continually export and import these tiny files.

       

       

      How do I get my generic container field PicUsersChoice to display the selected *contents* of container field PicA or PicB based on what the user chooses?

        • 1. Re: Replace Container Field Contents with User Selection
          siplus

          you could have a global repeating field, gPicUserChoice, and when the user selects the PicB of Record 3 you set the 3rd repetition of gPicUserChoice to the contents of PicB.

           

          Set Field [ gPicUserChoice[get(RecordNumber)]; GetField(yourcalculatedfieldname)

           

          then you have a grid layout where you display the repetitions, in any way you like.

          • 2. Re: Replace Container Field Contents with User Selection
            JPetersen

            I forgot to mention, I can get it to replace the contents of the current field with Replace Contents [with calculated results] so that the screen shows thumbnails from each record...but it doesn't work with the supplied variable...

             

            for it to work, the user has to 1) go into the Calculated result, 2) choose the current database, and 3) choose the appropriate pic container from a long list of fields.

             

            This is not user friendly (in fact, the user would be baffled). But putting the variable PicD in the calculation so the result is automated doesn't insert the pictures the same way as when it is done manually (the variable is being accepted and calculated correctly but doesn't replace the pics in the same way as when done manually).

             

            So, it works, but only manually. How do I automate this so I get the same result using a variable, without the user having to go through three manual calculation steps?

            • 3. Re: Replace Container Field Contents with User Selection
              JPetersen

              siplus wrote:

               

              "

              you could have a global repeating field, gPicUserChoice, and when the user selects the PicB of Record 3 you set the 3rd repetition of gPicUserChoice to the contents of PicB.

               

              Set Field [ gPicUserChoice[get(RecordNumber)]; GetField(yourcalculatedfieldname)

               

              then you have a grid layout where you display the repetitions, in any way you like."

               

              I did try it as a global variable yesterday (as an experiment), but then it put the same record in all the thumbnails instead of one from each record (as one might expect). When I turned off the global variable, then I would get a different thumbnail in each slot (one from each record in the found set), which is good, but... the user has to go through the calculation steps I noted above and it needs to be automated.

               

              But... I did it differently from what you suggest. I'm not using a repeating field (I'm not sure why it should be a repeating field and I was worried that repeating fields might be less flexible plus I've never tried repeating fields for containers before) but I'll tinker with it. First I have to bend my brain around why a repeating field would be better and then I have to figure out if the same manual process might be necessary if the variable doesn't want to work for containers in repeating fields the same way it is complaining for individual fields.

               

              By the way, I have no trouble getting what I want with text fields, and I can semi-automate the pics but I need it to work with pics in full script mode.

              • 4. Re: Replace Container Field Contents with User Selection
                JPetersen

                As a separate issue, there are two ways to do this:

                 

                1. Replace the contents of PicUserChoice with PicA or PicB, etc. (which takes a few moments to update the pic for each record). This is what my script currently does, but the user has to do three steps manually. It works, but it's slow.

                 

                OR (this would be better, if possible)...

                 

                2. To simply insert the user's choice of container field PicD on the current layout (which means no data has to be transferred, it only has to be displayed). Is there a way to do this through a script? To add a specific field to a layout automatically if the user is prompted for which field? This seems faster, but I don't know if such a thing is possible.

                 

                (I have an awful feeling the answer to #2 might be yes, but not in the client's version. Unfortunately, clients don't like being told to get rid of a good computer just so they can upgrade their software. Is adding a field via script possible in older versions?)

                • 5. Re: Replace Container Field Contents with User Selection
                  philmodjunk

                  To use the text in your variable to reference the container field, you just need the getField function.

                   

                  but the text has to include the table occurrence name as well as the field name.

                   

                  GetField ( "YourTable::" & $Variable )

                  • 6. Re: Replace Container Field Contents with User Selection
                    siplus

                    Let's go back to what you want to achieve, forget about implementation.

                     

                    What I understood was_

                     

                    1) User browses n records, each showing some pictures, and chooses 1 picture per record by clicking on it.

                     

                    2) Once record browsing is finished (or actually at any time) user can ask to see the chosen images, which will be shown in a grid.

                     

                    Is that correct, to start with ?

                    • 7. Re: Replace Container Field Contents with User Selection
                      JPetersen

                      No, user selects one image from one record (let's say PicD) and wants to see all the PicD images from all the found records at the same time.

                       

                      Imagine these are model parts. PicA is for propellors, PicB for wings, PicC for tails, PicD for wheels. So, the user wants to see all the thumbnails for wheels on one page all at one time,

                       

                      So, user clicks a button, software asks which pic to show, user responds with "d" (or "wheels" or whatever), and software goes to the thumbnail layout, turns the user's selection into "PicD" and shows all the wheels. User might then want to see all the propellors (next to each is a part number). There is likely to be a lot of repeated search and display of these parts. (It's not practical to make a different layout for each Pic because there are 30 containers in total in each record.)

                       

                       

                      I can get this to work if the user selects replace from the Filemaker menu, but it's several steps, it's not automated. I can also get it to work in a script to replace field contents if the user does three of the steps manually. In other words, it's not completely automated.

                       

                      However, if I do the same thing entirely in script steps (with replace field contents), it inserts the words "PicD" or a question mark into the container instead of the pics, (even though the result of the script is "container" rather than "text"). This glitch doesn't happen when replace field contents is done manually.

                       

                      I can't figure out why. I did check to make sure the table name is being inserted as part of the field name (the script step does this).

                       

                       

                      Ideally it should be possible to simply place whichever field the user picked onto the layout (thus just replacing the field, and not  replacing all the pics that are currently in the container), but I don't think Filemaker 10 advanced can do that. If so, I can't figure out how.