2 Replies Latest reply on Aug 3, 2010 12:49 AM by fluffyone

    line numbers and sorting in a portal



      line numbers and sorting in a portal


      Hi group

      I have a portal on a form that fills up as I create new records on the form, I would like to have each record create a line number for it's entry in the portal, the position the line is in on the portal is significant to the way i want to see the data, however if I want to slip a line in between other lines on the portal so I can rearrange the order, I would like to change the line number of that line so it goes in it's place and then all the other above it automatically change there numbers to suit. (like how the tabbed order works)

      I have tried a few things, any ideas?
      or perhaps a drag and drop methods, so that I can grab a line and drop it where I want?



        • 1. Re: line numbers and sorting in a portal

          I'd use the layout text @@ to number your portal rows. This will always perfectly number your rows with no gaps in the series. Then I'd use a separate number field on which to sort your records into the desired order. This hidden number field can have any number of "gaps"  or decimal values such as 2.5 in it's series. To change field's location in the sort order, you'd enter a number that falls between the two rows between which you want to insert it.

          Another approach is to use a find or go to related records to pull up the records in a found set on a layout based on the portal table's records, sort them in the desired order and then use replace field contents to assign a serial number to each of the records you've found and sorted. Thus, you can move a record to a different position by giving this "row number" field a value such as 2.5 to make it the third row in the portal and then use the sort and update script just described to renumber your records into a perfect sequence.

          • 2. Re: line numbers and sorting in a portal

            Hi Phil

            perfect, I didn't think about using decimals!

            Thanks, regards