1 2 Previous Next 16 Replies Latest reply on Jan 1, 2017 4:57 PM by BruceRobertson

    Two parents, one child

    darg

      Hello guys! I wish to everyone a happy new year.

      I am new to FM. I'm trying to create a Diary. I have the following tables:

      Diary --< StudyLog >-- StudyPart >-- StudyContent

      In my diary Layout, I have a portal. Through this portal I want to:

      • Create new records to StudyLog, StudyPart, StudyContent
      • IF there are existing records to StudyPart or StudyContent I want to keep those the same!

      Example: I create Day: "1/1/17". Through the Day's portal, I create

      StudyLog: "Log #: 1, Time: 9:00, Duration: 1hr"

      StudyPart: "StudyPart: Chapter 1, Chapter Title: Coulomb's Law"

      StudyContent: "Title: Quantum Physics, Author: ..., Type: Book"

      In the same Day, through the portal I want to create:

      New StudyLog

      Same StudyPart

      Same StudyContent

      When I write the StudyPart and it exists, I want it to auto complete. Same for the StudyContent.

       

      I tried to make it as simple and compact as possible. If you need pictures or anything else, please tell me. I would appreciate it if anyone could help.

      Thank you so much!

      Again, happy new year!

        • 1. Re: Two parents, one child
          philmodjunk

          You've set up StudyLog as a classic join table between two tables, Diary and and StudyPart. That's generally a good thing and fits what you want to do here.

           

          How much of this do you have working?

          Can you create new StudyLog records in the portal? (Enable create for stdLog in the stdPart to stdLog relationship)

           

          Have you set up _fkstdPartID with a value list that allows you to select the desired StudyPart? (This requires a "use value from field" value list where the values are drawn from the stdPart table (__pkstdPartID is field 1, PartTitle is field 2).

           

          Or do you just need help setting this up so that you can make a second entry that copies the value of the previous StudyPart's __pkstdPartID into the same field of the new record?

          • 2. Re: Two parents, one child
            David Moyer

            Hi,

            have you worked with auto-complete via a Value List?  You can define a text field on a layout to utilize a value list and also use auto-complete.  There is an option, when defining a value list, where you can show (and auto-complete) text, yet (behind the scenes) have FM provide the appropriate primary key from your child tables.

            • 3. Re: Two parents, one child
              darg

              Wow! This was fast. Guys thank you so much. I think you both are right with the Value List thing. I will have to check it out though. Again thank you. I've been struggling with this for the past two days! And this is my 3rd day using FM. I'll let you know.

              • 4. Re: Two parents, one child
                philmodjunk

                This file has a working example of what Dave is describing along with detailed information on how it works. It has a number of other examples that you might also find useful.

                 

                Adventures in FileMaking #2-enhanced value selection

                • 5. Re: Two parents, one child
                  darg

                  So, I tried to use a value list for the StudyContent title.

                  The name of the subject appears on the drop down list, but when I press it, it doesn't bring the data from the corresponding table. It tries to create a new record. Maybe I need to do some more studying...

                   

                  Any the case, I'm uploading my work. Hopefully what I'm trying to do will be clear if you see it directly. I would appreciate any help. Of course feel free to make any changes.

                  Thank you so much!

                  • 6. Re: Two parents, one child
                    BruceRobertson

                    Hrd 2 ans Qn bc U no xpln. File uz lotsa sht wds.

                    No scps. Rly - no scps; wow.

                    Iza jk? W? W? W?

                    diary fields.png

                    • 7. Re: Two parents, one child
                      darg

                      Haha! You're right. I'm sorry.

                      This is supposed to be a list of things I eat and drink during the day. Like a diet plan gyms give. For example the W stands for water in quantities of 0.5L. All those little abbreviations that are numbers are the same thing.

                      Thanks!

                      • 8. Re: Two parents, one child
                        wimdecorte

                        Let's take a step back then; you don't want to create a field for each type of thing you eat or drink.  That should be a record for each thing and the 'what' should be a value in that field, not a field name.

                        • 9. Re: Two parents, one child
                          erolst

                          Y cn sly dcphr _ sntnc tht hs n vwls — u _ e ae iou ooa!

                          • 10. Re: Two parents, one child
                            darg

                            I thought of that solution, and to be honest I don't know which one I like the most. At that point I was just starting, so that sounded complicated. What you're suggesting is probably a better way to go.

                            If I understood correctly, you're saying to create another table e.g.: "nutrition" and put all the related stuff as records in that table? I'll probably do it that way.

                            • 11. Re: Two parents, one child
                              BruceRobertson

                              "all the related stuff"

                              What does that mean?

                              Looks like it would be fkDayID; Item; quantity. Though the units of measure for the different items are probably different.

                              • 12. Re: Two parents, one child
                                David Moyer

                                Hi,

                                I second the idea of a table to replace most of those fields.  The other point I want to emphasize is that you should avoid any "codes".  "W" for a half-liter of water is not a good practice.  A good replacement would be a record in this second table with a field for ingestible and a field for quantity, etc.

                                • 13. Re: Two parents, one child
                                  BruceRobertson

                                  Some suggestions, see attached.

                                  • 14. Re: Two parents, one child
                                    darg

                                    Thank you Mr. Bruce! This is amazing.

                                    I was hoping that this would be a simple problem to solve with a little bit of learning, because I had some experience with MS Access a few years ago. But it turns out it's going to take a while because I don't remember anything from Access and I'll need some time to learn the filmmaker features I'd like to implement in my solution. FM is an amazing program with many capabilities and I understand now that I can create something beautiful using it. So I decided to put some time in learning it well and slowly create exactly what I want.

                                    I liked very much the idea with the + button. It's going to take a while for me to figure out what's going on with the

                                    relationships though.

                                    Thank you anyway!

                                    1 2 Previous Next