1 2 Previous Next 28 Replies Latest reply on May 16, 2014 9:41 AM by hanstrager

    Help to make a clever checkbox set with pictures

    hanstrager

      Title

      Help to make a clever checkbox set with pictures

      Post

           I have a small database that makes technical files for garments.
           My problem arises when I have to make washing instructions for the garments. I never remember the washing instructions for all the fabric that is being used, never mind the actually washing instruction icon.

           So i thought it would be good, to lock the washing instructions with icons to every single fabric, when the fabric is being typed into the database.

           I'm looking for some sort of way to have the icons of the washing instructions on my fabric layout, and with check boxes choose the pictures that is true for the specific fabric, and then have my selection show up in a different table and layout...

           Is this possible, or do someone have a better work around..?

        • 1. Re: Help to make a clever checkbox set with pictures
          philmodjunk

               Well a value list cannot display image data, only text. I recommend a portal displaying all possible images set up with a button that performs a script to select/deselect the IDs of the image records when clicked. This will look and feel like a set of check boxes but will not actually be a field with a check box group.

          • 2. Re: Help to make a clever checkbox set with pictures
            hanstrager

                 I'm wondering how this will look when print or export...?

                 Now I have a layout, where all the fabrics are shown for every single garment (see attached). I was thinking I should just have horizontal - next to the fabric - the different washing icons. But I guess if they come in a portal, then they will only show vertical and it could easily take a whole page if you have a garment with 7 different fabrics and some fabrics have 5-6 icons assigned? or is there a way around this..?

            • 3. Re: Help to make a clever checkbox set with pictures
              philmodjunk

                   Well you can't export graphics from FileMaker as part of an Export Records operation.

                   Data from related records can be listed horizontally using what we call a "horizontal portal". It's really a series of one row portals placed side by side. The first portal specifies and initial row of 1, the next specifies an initial row of 2 and so forth...

              • 4. Re: Help to make a clever checkbox set with pictures
                hanstrager

                     Ok so the graphics can be shown side by side.

                     I've now created a new table called 'Washing instructions' and linked that to my 'Fabrics' table.

                     On the fabrics layout I've created a portal which is set to show records from 'Washing instructions' and should be showing my 'text' and 'icon' container.

                     Though nothing is showing in the portal. Also I'm a bit unsure how to relate the washing instruction::ID to a check box in the portal...?

                • 5. Re: Help to make a clever checkbox set with pictures
                  hanstrager

                       Sorry forgot to send a screen grab of my relationship graph:

                  • 6. Re: Help to make a clever checkbox set with pictures
                    philmodjunk

                         Note that you have a many to many relationship between Fabrics and Washing Instructions. A given fabric may need to be linked to more than one icon and a given icon will be linked to many fabrics.

                         This will either require a join table such as your line items table shown here for a different many to many relationship or you'll need to build a list of ID's separated by returns in a single field in the Fabrics table.

                         Both set ups are possible for producing the desired result.

                         For a working example of using a join table for this, see the "check boxes" example in this demo file: https://www.dropbox.com/s/oyir7cs0yxmbn6i/ManyToManywDemoWExtras.fp7 (If you are using FileMaker 12 or newer, use Open from FileMaker's File menu to open this file and produce a copy converted to the newer file format.)

                         Please note that what looks like check boxes in the rows of this portal are not actually check boxes. They are buttons that perform scripts that create or delete records in a join table with conditional formatting used to make the "x" appear or disappear to show whether a join table record for that option exists.

                    • 7. Re: Help to make a clever checkbox set with pictures
                      hanstrager

                           Thank you so much for drop boxing me you file.

                           I've had a look at it, not sure I completely understand all your layouts.

                           I've created a many to many relationship.

                           Made a box with a X which I set a conditional formattin:

                           IsEmpty ( FilterValues ( List ( Washing instructions::ID) ; Fabrics::xFabric_ID ) ) 

                           Then I grouped the 'x' with my washing instructions::text and added a added a perfom script in button set up. I copy pasted your script and tried to match the different layouts and fields. Since it's not working I'm pretty sure i mixed it up:

                            

                      Freeze Window

                      Set Variable [ $EventID; Value:Fabrics::xFabric_ID ]

                      Set Variable [ $ContactID; Value:Washing instructions::ID ]

                      If [ ValueCount ( FilterValues ( List ( line items washing ins.::Washing inst. ID_FK ) ; Washing instructions::ID ) ) // Contact is already selected; deselect it. ]

                      Go to Layout [ “Washing instructions” (Washing instructions) ]

                      Enter Find Mode [ ]

                      Set Field [ line items washing ins.::Washing inst. ID_FK; $ContactID ]

                      Set Field [ line items washing ins.::Fabric ID_FK; $EventID ]

                      Perform Find [ ]

                      Delete Record/Request

                      [ No dialog ] Else

                      Go to Layout [ “Washing instructions” (Washing instructions) ]
                      New Record/Request
                                          Set Field
                      [ line items washing ins.::Washing inst. ID_FK; $ContactID ] Set Field [ line items washing ins.::Fabric ID_FK; $EventID ]

                      End If
                                          Go to Layout
                      [ original layout ]

                                          I still can't see any of my records from washing instructions in my portal in fabric..?

                            

                      • 8. Re: Help to make a clever checkbox set with pictures
                        philmodjunk

                             I'd rename the variables to name them similar to the field names from which they get their values.

                             The check boxes example uses two table occurrences of the far related table (Washing Instructions in your case). One is related by the X operator and makes possible a portal listing all records found in Washing Instructions in order to be set up with what looks and functions like a check box list.

                             Fabrics::anyField X Washing Instructions|All::anyfield

                             It does not matter which field you select in Fabrics and Washing Instructions|all to use as match field so long as you change the = operator to X.

                             The other table occurrence of this same table is linked like you have it in the screen shot you have just posted. It is needed for your horizontal portal to be able to list the icons linked to a particular Fabric record.

                             So without that extra table occurrence, you can't set up your layout for this to work.

                              

                        • 9. Re: Help to make a clever checkbox set with pictures
                          hanstrager

                               Ok, It almost works...

                               The only thing I can't get working is getting my 'X' to disappear when clicking on the record in the portal.

                               I have the following conditional formatting attached to the 'X':

                               IsEmpty ( FilterValues ( List ( line items washing ins.::Washing inst. ID_FK ) ; EchAllWashing ins.::Washing inst_ID ) )

                                

                               Then how do I make the other portal(s) to show the records across..?

                               Is it also possible to add some extra little script so you are only allowed to click 8 items..?

                                

                          • 10. Re: Help to make a clever checkbox set with pictures
                            philmodjunk

                                 The expression looks correct for the conditional format. Then you click "more formatting" and specify a font size of about 120+ points. (The exact size depends on the normal font size of the "x" when it is visible.) The extreme font size change makes the text disappear.  If you have FileMaker 13, you can use the new "Hide Object When" setting instead of a conditional format to make the X appear and disappear.

                                 

                                      Then how do I make the other portal(s) to show the records across..?

                                 Place a portal to Washing Instructions on your Fabrics layout. Put the icon (and Text if you want it) in the portal row. Make it a one row portal. Then duplicate this portal, (Ctrl/option drag, copy paste, ctrl-D or Duplicate from the Edit menu). Open portal setup and change the Initial Row setting from 1 to 2. Repeat, changing the initial row setting for each new one row portal thus created.

                                 

                                      Is it also possible to add some extra little script so you are only allowed to click 8 items..?

                                 In the part of your script that adds a new line item record, have it first do this:

                                 If [ Count ( Line items washing ins.::Fabric ID_FK ) < 8 // haven't reached maximum of 8 selected instructions ]
                                     Code to add new join table record goes here
                                 Else
                                     Show Custom Dialog ["You cannot select more than 8 washing instructions for a given fabric." ]
                                 End IF

                            • 11. Re: Help to make a clever checkbox set with pictures
                              hanstrager

                                   It works like a dream, I used the hide function...

                                   One last thing, I have a dublicate button for my fabric, when I dublicate the fabric I would like to also dublicate the selected washing instructions. Not sure where to start with this..?

                              • 12. Re: Help to make a clever checkbox set with pictures
                                philmodjunk

                                     I have  script for that: Duplicating Bill Of Materials (duplicating portal line items)

                                     Be sure to base your thread on the final version of the script in this thread. The original version has a small flaw corrected in the final version.

                                • 13. Re: Help to make a clever checkbox set with pictures
                                  hanstrager

                                       when I test the script filemaker starts copying uncontrolled... What am I doing wrong..?

                                  Freeze Window
                                                      Set Variable
                                  [ $RecordNumber; Value:Get (RecordNumber) ]

                                  Duplicate Record/Request
                                                      Set Variable
                                  [ $FabricID; Value:Fabrics::xFabric_ID ]
                                  Go to Record/Request/Page [ $RecordNumber ]
                                  If [ not IsEmpty (line items washing ins.::Fabric ID_FK) ]

                                  Go to Record/Request/Page

                                  [ First ] Loop

                                  Duplicate Record/Request
                                                      Set Field
                                  [ line items washing ins.::Fabric ID_FK; $FabricID ]

                                  Omit Record
                                                      Exit Loop If
                                  [ Get (FoundCount) = 0 ]

                                  End Loop

                                  Go to Layout [ original layout ]

                                  Go to Record/Request/Page

                                  [ Last ] End If

                                        

                                  • 14. Re: Help to make a clever checkbox set with pictures
                                    philmodjunk

                                    Go to Record/Request/Page[First]
                                    LOOP

                                         should be:

                                         Go To Related Record [Show only related records; From table: line items washing ins; Using layout: "line items washing ins" (line items washing ins) ]
                                         Loop

                                         There may be other errors in your script, but that's the first one that I can see from a quick look at your script. The script needs to pull up the found set of related records on a layout based on the related records table before using a loop to generate a duplicate of each record followed by modifying the fk field to link to the new parent record instead of the original.
                                          

                                    1 2 Previous Next