11 Replies Latest reply on Oct 20, 2009 1:32 PM by thong127

    Sort Script Problem

    thong127

      Title

      Sort Script Problem

      Post

      Hi to Everybody,

       

      I have a Script for sorting, but when I try to execute it there is a pop up menu that it says

       

              Some fields in the sort order are invalid or cannot be sorted. you must remove these fields from the sort order before performing a sort.

       

      can you help me figure out please.

       

      thank you.

       

      thong

        • 1. Re: Sort Script Problem
          davidanders
            

          The Sticky at the top of this forum suggests the info you should provide to get the best help.

           

          Can you sort the fields one at a time using the sort function in the menu?

          What fields and what type of field are they? 

          • 2. Re: Sort Script Problem
            philmodjunk
               Open the sort step in your script and re-specify each field you want to include in your sort order. Perhaps you have changed a field definition to global storage or some such. Updating your sort step should enable you to figure out which field or field is the source of the error message.
            • 3. Re: Sort Script Problem
              thong127
                

              I have a Field "Sortby" Type is "Number", Comments is "Global", and my script is

              If [materials table entry::productname="product1"]

              setfield[materials table entry::sortby; "product2"]

              sort records [restore;no dialog]

              else

              set fields[materials table entry::sortby;"product1"

              sort records [restore;no dialog]

              end if

              go to record/request/page[first]

              refresh window

               

              Thank you.

              • 4. Re: Sort Script Problem
                philmodjunk
                  

                That script looks a bit odd.

                 

                In the script editor, when you double-click the two sort script steps, what fields are listed in the sort order box?

                 

                What results do you expect to get from this script?

                 

                What is this line

                 

                  setfield[materials table entry::sortby; "product2"]

                 

                supposed to do for you?

                • 5. Re: Sort Script Problem
                  thong127
                    

                  Hi PhilModJunk,

                   

                  What is this line

                    setfield[materials table entry::sortby; "product2"]

                  supposed to do for you?

                   

                  It will sort the product in descending order. kindly please  suggest what I'm gonna do because I dont know if Im in the right way or not. thanks

                  • 6. Re: Sort Script Problem
                    philmodjunk
                      

                    thongLoreto wrote:

                     

                    It will sort the product in descending order. kindly please  suggest what I'm gonna do because I dont know if Im in the right way or not. thanks


                    No it doesn't. That's why I asked.

                     

                    That step copies the the text "product2" into the number field called "sortby". It won't have any affect on sort order though it may change how the current record sorts if sortby is a specified field in the restored sort order of the script step that immediately follows it.

                     

                    Double click the two sort script steps. Whatever appears in the sort order box in these two steps is what you get when it sorts.


                    • 7. Re: Sort Script Problem
                      thong127
                        

                      Is there way that i can upload my sample file in the forum so that you can take a look for it?

                       

                      Thanks.

                      • 8. Re: Sort Script Problem
                        philmodjunk
                          

                        There's no direct way. You can upload it to a file share site and post a link to it here. Or you can email a copy to me. If you want to try that, click my forum name and send me a private message. I'll respond with my email address.

                         

                        You never answered my earlier question:

                         

                        When you double click each of the two "sort" script steps, what do you see listed in the sort order box?

                        • 9. Re: Sort Script Problem
                          thong127
                            

                          If I click the each of the two sort steps, theres nothing listed in the sort order box.

                           

                          After I will finalize my data base I will send you a private message and the link of my data base.thank you for your untiring support.

                           

                           

                          • 10. Re: Sort Script Problem
                            philmodjunk
                              

                            That explains the error message. Instead of trying to do this with Set Field, specify the order you want by selecting the fields that contain the data you want to sort in this sort order dialog. You might want to try manually sorting your database a time or two before you attempt to script it. The process works the same and you can instantly see the results of your sort attempts.

                             

                            Pick a layout that displays multiple records in a list or table and choose Sort from the Record menu. Try selecting different fields and clicking Sort to see what happens. Once you can get this to work, try including it in your script.

                            • 11. Re: Sort Script Problem
                              thong127
                                

                              Hi PhilModJunk,

                               

                              Thank you very much for your insights, my sort script now is working. the only problem is the two sort order..there is no specific table for sorting. and I made also a list values that will customized the sort order. thank you very much to your suggestions...I appreciate it. More Power....