6 Replies Latest reply on Jul 1, 2013 2:03 AM by markpayne

    re ordering a set of records by mouse click ?



      re ordering a set of records by mouse click ?


           I have a set of records that need to be reordered every day. They have an order field that I can clear renumber automatically, at present i am changing the record order by manually entering a new number then doing a sort.


           What i would like to do is click a button withinn the record that puts the number "1" in the order field, then click the record i want 2nd which puts the number "2"  automaticaly into the order field so on and so on.



        • 1. Re: re ordering a set of records by mouse click ?

               Create a List view layout with all of your records be reordered.  In each line of the Layout , create a button to script with your counter.  Such that the script will Add one to the counter and Set Field YourRecord number.  

               FMP selects the record when you click on the button in each row.surprise

               I would at a Clear All button when resets your counter,  in case of errors in clicking.


               I have a suggestion tho... what are you using to decide on the "reordering"?  Is it Random?  If not, why not encode your thoughts to autosort the list and save your time?  We sometime forget we humans think purty fast and forget mental flash sorts.angel


          • 2. Re: re ordering a set of records by mouse click ?

                 Thanks for that, in answer to you question it's. a list of songs with cue points for a show , most night there are changes in the set list order

                 Could you give me a few more details as to the script ststeps many tthanks mark

            • 3. Re: re ordering a set of records by mouse click ?

                   Sorry to probe.  Cue points are almost random.wink  I would take one path if i had to reorder 10 cues point per show  versus say reorder 100 points that needed reordering.  The difference being the amount of reordering by hand.  My thinking says you created the cue points in "almost the right order" and you need to adjust a few around .  

                   CASE I example:  CueID=10 needs to be inserted in front of CueID=8 etc. for  say 10 similar moves before "Final" reordering of the show Cue's.

                   CASE 2 example:  90% of all the Cues need major reordering.  Or a bunch of clickscrying

                   Either CASE you need to create a number type field in each record.  This is NOT the record number!  lets name it CueOrder.  It should be Auto entered on creation of each Cue record and sequenced from 1 increment by 1.  It will "mirror" the Cue record creation order and will be the initial Show cue order.  Now create a List type Layout that has the CueOrder in each row and sort the List by CueOrder.  I would have a Footer Layout part where i would put 3 scripted buttons named  Re-SORT  ;  Re-ORDER ; FINAL.  Scripts in a minute.....

                   Lets say your Cue record number is named CueID.  "CueID" is NOT equal "CueOrder"surprise  [except if there are no changes or in Final show.]

              CueOrder should be formated number as Decimal with 3 places.

              CASE 1

                   To move CueID = 10 in front of CueID = 8 ...  Change the CueOrder to a new value of 7.9  [initially 10.000]

                   Now click your Re-SORT button to Sort the Layout list based on decending CueOrder.yes  Then 7.9 is now in front of 8.wink  Oh my... CueID 33 needs to be behind CueID 8 and  in front of 7.9.  You change CueOrder 33 to 7.91.  and Re-SORT again.  Now the order is 6, 7.9, 7.91, 8.  Damn that gets messy.  Then click your Re-ORDER button to use Replace Varable function on CueOrder using 1 increment by 1 to clean up CueOrder to fresh whole numbers and 6, 7, 8, 9 [old 8]

                   Now we are done.  Click FINAL button to Re-ORDER and do final show script sorted by CueOrder.yes

                   This CASE is closest to what you do now and does not need a button on each Cue line.  Scripts for the Buttons should be obvious and short, but i will help if Case I  is not what you want.






              • 4. Re: re ordering a set of records by mouse click ?

                     thanks, I have a max 30 records of different songs and need to just reorder these, at present I am entering numbers in a field called order, I have automated this a bit by having a re number button which puts the numbers back to whole numbers also a clear order field I also have an omit button for songs not to be included in the final list.

                     To start I find all and then omit the ones i dont want, i then have to renumber the songs manually and re sort, What i would like to do is find all then omit then mouse click each record to put it in the right order.


                     thanks for your help I hope this makes it clearer ?

                • 5. Re: re ordering a set of records by mouse click ?

                       Got it now!yes

                       I would do CASE 3  which would be a hybrid of the 2 CASE's.  Set your List form Layout Count field, number format to Decimal 3 places. Create a new Button that is thin enough to fit on the List form line with the Count Field et al.  Lable the button say....NEXT#

                       In your Initial Script to Show All Records add these script steps to clear a counter and your Count fields.

                  Set Variable [$$Counter; Value:0]     // starts you order counter at zero

                  Replace Variable Contents [ YourTable::Count ; "" ]       // clears all previous Shows using Calculate Replace with ""

                       I will now assume you have reached the point of the final found set of 30 Songs in the Browse mode.  You should see the NEXT# button repeated on each line of the List form and Count field empty.  Now click on the NEXT# button for the Number 1 song, which will be set to Perform Script of the following scipt.

                       I named mIne... SetCount   

                  Set Variable [$$Counter; Value:$$Counter + 1]

                  Set Field [ YourTable::Count ; $$Counter ]

                  Commit Records/Requests [NoDialog]

                       Just a 3 line script that you will need to click on the NEXT# button 30 times in the order you want.wink  The Count field should be numbered in the order you clicked each line.

                       I would still do my CASE 1 too.  Why?  Just in case you goof up or want to just change one or two without clearing and reclicking 30 times again.cool.  Then  you would resort , re-Order etc as needed.


                       PS: Your found set will now have Count Field "not Empty"  making it is easy to Find "not Empty" until you clear all Count Fields for next show.  You can even save a Show by Saving that found set.


                  • 6. Re: re ordering a set of records by mouse click ?



                         That worked thanks, I took a while to get the right script sets but it all makes sense, thanks very much