14 Replies Latest reply on May 2, 2014 5:30 AM by umendes

    How to create Planninglines of a training

    umendes

      I am building a module for planning trainingsession.

      I have two tabels, Training and trainingdat

       

      If i am in the layout Tarining, i want to start a script to add 30 lines in the Layout trainingdata.

      Without getting the layout n my screen.

       

      Does somebody has a script or an example how to do this.

        • 1. Re: How to create Planninglines of a training
          erolst

          umendes wrote:

          If i am in the layout Tarining, i want to start a script to add 30 lines in the Layout trainingdata.

           

          I assume that by “line” you mean related record. You are using unique primary IDs in both tables, and a foreign training ID in TrainingData? Good.

           

          Then use a script along those basic lines:

           

          Set Variable [ $trainingID ; Training::_pk_trainingID ]

          Freeze Window

          Go to Layout [ TrainingData ( TrainingData ) ]

          Loop

            Exit Loop if [ Let ( $i = $i + 1 ; $i > 30 ) ]

            New Record/Request

            Set Field ( TrainingData::_fk_trainingID ; $trainingID ]

          End Loop

          Go to Layout [ original layout ]

           

          Attach it to a button on the Training layout so it can only be started in the correct context.

           

          You may also want to think about adding a check for the number of already existing records.

          • 2. Re: How to create Planninglines of a training
            coherentkris

            Another way to do it without actually changing layout context.

            • 3. Re: How to create Planninglines of a training
              umendes

              Thank you very much,

               

              I was very close to what you suggest.

              I missed the Freeze Window. And the Exit Loop if (with the ....

               

              Urfried Mendes

               

               

              Op 1 mei 2014, om 13:33 heeft erolst het volgende geschreven:

               

               

              created by erolst in DevCon - View the full discussion

               

              • 4. Re: How to create Planninglines of a training
                umendes

                Sorry,

                 

                But i don not get it done !!

                 

                 

                Just made a small loop of 1 for testing.

                It's a Dutch system , sorry for that.

                 

                Any idea ?

                 

                Cursussen is the main table

                Cursusdata is the 1 to many , relationship

                 

                I hope you can help me. I tried now several things , but ........

                 

                 

                 

                 

                Op 1 mei 2014, om 13:33 heeft erolst het volgende geschreven:

                 

                 

                created by erolst in DevCon - View the full discussion

                 

                • 5. Re: How to create Planninglines of a training
                  erolst

                  umendes wrote:

                  But i don not get it done !!

                  […]

                  Just made a small loop of 1 for testing.

                  It's a Dutch system , sorry for that.

                   

                  That's not much to go on. Please post your script.

                   

                  Iif you're on OS X, you can open the script, press Cmd-P and select “Open PDF in Preview” in the Print dialog to copy the text from a temporary PDF; if you're on Windows … no idea

                  • 6. Re: How to create Planninglines of a training
                    umendes

                    This is the script :

                     

                    Variabele instellen $cursusid; waarde:cursussen::cursusnummer          Set variabel

                    Venster vastzetten                                                            Freeze Window

                    Ga naar lay-out ["cursusdata"(cursusdata)]                                   Ga to cursusdata layout

                    Loop

                         exit Loop If

                         Nieuw record/nieuw verzoek                                             New record

                         Veld instellen [cursusdata::cursusnummer[$cursusid]]                    Set field , cursusnumber of cursusdate fill with $cursusid

                    End Loop

                    Ga naar lay-out                                              Ga to original layout

                          

                     

                    Sorry for the Dutch, but i translated it as much i could do.

                     

                    Thanks for your reply

                     

                    urfried mendes

                     

                     

                     

                     

                     

                     

                    Op 1 mei 2014, om 16:27 heeft erolst het volgende geschreven:

                     

                     

                    created by erolst in DevCon - View the full discussion

                     

                    • 7. Re: How to create Planninglines of a training
                      erolst

                      umendes wrote:

                      Veld instellen [cursusdata::cursusnummer[$cursusid]]   

                      Well, that doesn't look right: it seems you used the variable as repetition parameter, instead of as result expression. It should look like so: Veld instellen [cursusdata::cursusnummer ; $cursusid ]   

                       

                      Note that Set Field has two options. Specify Target Field: click and select cursusdata::cursusnummer from the field list; Specify Calculated Result: click and insert $cursusid into the Specify Calculation dialog.

                       

                      Alas, the Forum software has somehow maimed your post, so I can't see what you're doing in the Exit Loop calculation. See attached for a “live” view of the script and the correct way to specify the calculations.

                       

                      On a general note: please give a more descriptive error report than “it doesn't work” …

                      • 8. Re: How to create Planninglines of a training
                        umendes

                        To all,

                         

                        I only get complete empty records in the cursusdata table.

                        What am i doing wrong.

                         

                        Hope somebody can tell , what i am doing wrong.

                         

                        Thanks

                         

                        Urfried Mendes

                         

                        Two screen shots of my Application and a PDF of the script.

                         

                         

                         

                         

                         

                         

                         

                         

                        See my script.

                         

                         

                         

                         

                        Op 1 mei 2014, om 17:13 heeft erolst het volgende geschreven:

                         

                         

                        created by erolst in DevCon - View the full discussion

                         

                        • 9. Re: How to create Planninglines of a training
                          erolst


                          umendes wrote:

                          I only get complete empty records in the cursusdata table.

                           

                          Well, these records should at least have the table's primary ID auto-set …

                          umendes wrote:

                          Two screen shots of my Application and a PDF of the script.

                          See my script.

                           

                          There's nothing attached to your post.

                          • 10. Re: How to create Planninglines of a training
                            umendes

                            How do i include these PDF to the discussion forum (DevCon). I do not see any attachment possibility.

                            Or please give me a email address , where i can forward the mail with the PDF and the screenshots.

                             

                             

                             

                             

                            Op 2 mei 2014, om 12:54 heeft erolst het volgende geschreven:

                             

                             

                            created by erolst in DevCon - View the full discussion

                             

                            • 11. Re: How to create Planninglines of a training
                              erolst

                              umendes wrote:

                              How do i include these PDF to the discussion forum (DevCon). I do not see any attachment possibility.

                               

                              When you post, there is a number of icons in the bar above the text area, including two that let you upload media. If they don't do the trick, click “Use advanced editor” to get to the … well, “advanced” options, including other uploading functions.

                               

                              btw, not that anyone seems to care, but DevCon wasn't the appropriate sub-forum for your question anyway …

                              umendes wrote:

                              Or please give me a email address , where i can forward the mail with the PDF and the screenshots.

                              Let's keep this public, unless you need special advice, or this turns out to be a really complicated matter (though I'd be hard-pressed to imagine that); in that case, send me a PM.

                              • 13. Re: How to create Planninglines of a training
                                erolst

                                You obviously didn't read my reply in post #7:

                                Well, that doesn't look right: it seems you used the variable as repetition parameter, instead of as result expression. It should look like so:

                                 

                                Veld instellen [cursusdata::cursusnummer ; $cursusid ]

                                and NOT [cursusdata::cursusnummer [ $cursusid ] ].

                                 

                                The same goes for the the other field.

                                 

                                In brief: the variable holds the value you want to set into the field; you do NOT use it to specify the repetition in the field selection dialog (just ignore that option).

                                Note that Set Field has two options. Specify Target Field: click and select cursusdata::cursusnummer from the field list; Specify Calculated Result: click and insert $cursusid into the Specify Calculation dialog.

                                • 14. Re: How to create Planninglines of a training
                                  umendes

                                  Thanks,

                                   

                                  It is working now.

                                  Now i can go-on. Still a lot to discover.

                                  Such as counting days to a date field. And much more.

                                  Anyway, you are a great help.

                                   

                                  Urfried

                                   

                                  Sorry , sometimes the translations to Dutch are to difficult and sometimes hard to understand.

                                   

                                   

                                  Op 2 mei 2014, om 14:15 heeft erolst het volgende geschreven:

                                   

                                   

                                  created by erolst in DevCon - View the full discussion

                                  You obviously didn't read my reply in post #7:

                                   

                                  Well, that doesn't look right: it seems you used the variable as repetition parameter, instead of as result expression. It should look like so:

                                   

                                   

                                  Veld instellen cursusdata::cursusnummer ; $cursusid

                                   

                                  and NOT [cursusdata::cursusnummer ].

                                   

                                   

                                  The same goes for the the other field.

                                   

                                   

                                  In brief: the variable holds the value you want to set into the field; you do NOT use it to specify the repetition in the field selection dialog (just ignore that option).

                                   

                                   

                                  Note that Set Field has two options. Specify Target Field: click and select cursusdata::cursusnummer from the field list; Specify Calculated Result: click and insert $cursusid into the Specify Calculation dialog.

                                   

                                  Reply to this message by replying to this email -or- go to the message on FileMaker Technical Network

                                  Start a new discussion in DevCon by email or at FileMaker Technical Network

                                  Manage your email preferences.

                                   

                                  FileMaker Developer Conference 2014 • San Antonio, Texas • July 28-31 • www.filemaker.com/devcon