10 Replies Latest reply on Nov 7, 2016 3:40 PM by Flyfisher2611

    Marking a found set as ordered with a button

    Flyfisher2611

      hi

       

      i have a found set of records in a report grouped under an order reference.

       

      Is is it possible to mark the found set as ordered with a script and/or a button, without visiting or selecting each record individually?

      If so Can this be done from the sub summary in the report?

       

      thank you!

       

      Alan

        • 1. Re: Marking a found set as ordered with a button
          Johan Hedman

          You can do that by using the ExecuteSQL function

           

          Here are a article where you can read more about that function

          https://filemakerhacks.com/2012/10/19/the-missing-fm-12-executesql-reference/

          • 2. Re: Marking a found set as ordered with a button
            Mike_Mitchell

            If by "mark the found set as ordered" you mean "set a field on each record to indicate that it's in 'ordered' status", then something like Replace Field Contents will work.

             

            However, you do need to be careful in a multi-user environment, as such operations can fail if another user has the record locked.

             

            If that's not what you're looking for, give us some more detail and maybe we can give you a better answer.

            • 3. Re: Marking a found set as ordered with a button
              Flyfisher2611

              Hi Mike

               

              thank you for your repl!

               

              i think a 'replace field contents' button sounds fine. It is not in a multiuser environment, and will only be used by me.

              To clarify, I wish to run a report on screen that will catagarise in the following order.

               

              Supplier Name

              Order Referance

              Order Week Number

              followed by a list of the found records.

               

              I would like to place on the  'Order Referance' summary line,  a button that would run a script to automatically 'replace field contents' in the Order Status field from "Not Yet Ordered" to "Ordered"  (using your suggestio!)

               

              so  do I assume that is the way forward?

               

              and is it easy enough to limit this to only the found set linked via the same 'order reference'

               

              thank you again for your reply

               

               

              regards Alan

              • 4. Re: Marking a found set as ordered with a button
                Flyfisher2611

                Thank you for your reply Johan

                 

                the  link you supplied is very thorough,  and I will ok further into it! Given my lack of experience, Mikes looks a simpler option for me, would you agree? Or do you think it would be worth perseverin with your suggestio?

                 

                thank you one again

                 

                regards

                 

                alan

                • 5. Re: Marking a found set as ordered with a button
                  Mike_Mitchell

                  Hello Alan.

                   

                  I'm not 100% certain what you're asking, but if you mean "I want to replace the Order Status field with 'Ordered' in those records that match the Order Reference of the current record" (which is what you get when you click in a summary part), then something like this might be what you need:

                   

                  Set Variable [ $orderRef ; Value: myTable::Order Reference ]

                  New Window [ ]

                  Enter Find Mode [ ]

                  Set Field [ myTable::Order Reference ; Value: $orderRef ]

                  Perform Find [ ]

                  Replace Field Contents [ myTable::Order Reference ; Value: "Ordered" ]

                  Close Window [ ]

                   

                  If you mean "I just want to update all the records in the found set," then just use the bolded step.

                   

                  There are other ways to accomplish the isolation of the found set, but using a new window preserves your existing found set. So this will probably work okay.

                   

                  HTH

                   

                  Mike

                   

                  P. S. Be very careful with Replace Field Contents. I've told people this is FileMaker's nuclear weapon. You can't undo the changes, so make really sure you have the right found set and field.

                  • 6. Re: Marking a found set as ordered with a button
                    Flyfisher2611

                    Hi Mike

                     

                    Thank you! I shall proceed with Caution!

                     

                    Sorry if I am not explaining myself very well!

                     

                    The parts in my report are as follows

                    the main summary is by the supplier name

                    followed by the order reference (this groups all the trays of plants I am ordering, under the order reference I am using for this order, as follows

                     

                    Syngenta Seeds

                                              "Plants for Hanging Baskets"          order Status "Not Yet Ordered"  {BUTTON TO GO HERE}

                    Delivery Week 10

                     

                    Petunia Pink                               "Not Yet Ordered/Ordered"

                    Lobelia Blue                                "Not Yet Ordered/Ordered"

                    Lobelia White                             "Not Yet Ordered/Ordered"

                    Verbena Blue                               "Not Yet Ordered/Ordered"

                    Viola Yellow                                 "Not Yet Ordered/Ordered"

                    etc

                     

                    Supplier Name

                    Order Reference

                    Order Week Number

                     

                    followed by a list of the found records.

                     

                    I would like to place, on the  'Order Reference' summary line,  a button that would run a script to automatically 'replace field contents' in the Order Status field from "Not Yet Ordered" to "Ordered" and in turn update the order status of each individual record of the plants categorised under the order reference!

                     

                    Once again I apologise if I am not explaining things very clearly, I'm new to this tech stuff! :-)

                     

                     

                    thank you again for your reply

                     

                    Regards

                     

                    Alan

                    • 7. Re: Marking a found set as ordered with a button
                      Mike_Mitchell

                      I still don’t understand what you have. Is “Order Reference” in the Body, or is this another sub summary? How do you know what plants are categorized under the Order Reference? Are they the same or different records as those under “Delivery Week 10”?

                       

                      Basically, if you want everything in the found set, then it’s easy enough. But if you have records in the found set that you do not want to update, ir requires more work.

                      • 8. Re: Marking a found set as ordered with a button
                        Flyfisher2611

                        Hi Mike

                         

                        The order reference is another sub summary, as is the delivery week number. The body of the report is the plants that are being ordered from That Supplier, under That Order Reference, on That Delivery Week.

                         

                        Yes, everything in that found set needs updating to 'Ordered'

                        • 9. Re: Marking a found set as ordered with a button
                          Mike_Mitchell

                          As long as you can guarantee that, you don’t need to do anything fancy. Replace Field Contents on the found set will work fine.

                          • 10. Re: Marking a found set as ordered with a button
                            Flyfisher2611

                            Hi Mike

                             

                            No, nothing fancy from me I'm afraid! Thank you very much indeed for your help, it is very much appreciated!

                             

                            If you find yourself in need of some bedding plants, then please get in touch!!!!

                             

                            regards

                             

                            Alan