2 Replies Latest reply on Mar 4, 2014 1:40 PM by AdamHorne

    Help with Sorting!

    AdamHorne

      Title

      Help with Sorting!

      Post

           I'm having a problem sorting rows on a portal. Here is a basic ERD of my Database:
            
                When I'm on the Order Layout, I'm using the portal add Equipment to OrderLines. I'm adding what I call "Parent" or "Main" equipment items to the order. Once I finish, I run a script that goes to the accessory table and will find any accessory records for each "Parent" item and adds them to the order.  
                      
                     I would like to sort the portal by Parent » Its Accessories ; Parent » It's Accessories ; etc... 
                      
                      
                          I'm trying to figure out how to do this...
                           
                          I've thought of trying to use a Value List; but I'm having trouble determining how to set this up in order for it to work.  
                           
                          I've thought of using an additional field for the purposes of sorting, but I ran into this problem:
                           
                           
                           
                          As you can see the item 29" Scrim is used with two different "Parent" items, so I was unable to determine how to use an additioanl "sort" field. 
                           
                          The only option that I can think of is to add an additional field in the OrdersJoin table with a auto-enter serial with an increment of 10.  Then I would add aditional script steps to get the value of each "Parent" Item and add it's accessories within the 10 records buffer. 
                           
                          However, while I don't have any "Parent" items with more than 10 accessories, it doesn't seem like great option, for obvious reasons.  
                           
                          Thanks for any help.

            

        • 1. Re: Help with Sorting!
          philmodjunk

               I'd use a script performed by a script trigger that added the accessory items for one "parent equipment" record immediately after you added that one parent. That puts the records immediately after the parent equipment record without any sorting needed.

               But using your method, it should be possible to assign the primary key of parent equipment record in OrderLines to a sort field for that item and it's accessory records. You then have a common value to use for sorting that will group them together.

          • 2. Re: Help with Sorting!
            AdamHorne
                 

            I'd use a script performed by a script trigger that added the accessory items for one "parent equipment" record immediately after you added that one parent. That puts the records immediately after the parent equipment record without any sorting needed.

                  

                 Thanks for your suggestion Phil.  There have been a few instances where I've only taken the parent item with no accessories.  I do like the idea of a script triggers though.  I keep forgetting they're there. 

                 I think I've found a workaround, if anyones interested.  I created a new field called OrderLine and made it a text field with an auto enter serial value. When the accessory item gets added to the order, I use a set field step and place the value of its Parents OrderLine and I concatenate "-01".  

                 Example:

                  

                                                                                                                                                                                         
                                OrderLine                     Item
                                100                     18K
                                100-01                     18K Accessory

                  

                 I don't foresee any problems with this, but I suppose only time will tell...

                  

                 Thanks again.