2 Replies Latest reply on Apr 1, 2010 6:27 AM by mr.b.

    New Record, choosing the position for new record in a portal

    mr.b.

      Title

      New Record, choosing the position for new record in a portal

      Post

      Hi All,

       

      I have a portal that displays records that are appointments.

       

      It is set to sort the records so that the most recent is at the top of the list. So far so good.

       

      My only problem is that when you create a new record in the portal, it appears in the last row of the portal, whereas i would rather it would appear at the top of the portal, ahead of the previous booking. If i just click of the fields, it then re orders it but I'd rather it was at the top.

       

      The script has a step that is "Goto Portal record Select:Last" and I have tried changing this to "First" but that then just puts the cursor into the most recent appointment rather than a blank new record.

       

      Any ideas how i can make this happen?

       

      Many Thanx in advance

       

        • 2. Re: New Record, choosing the position for new record in a portal
          mr.b.

           

          Hi Mr.Vodka,
          Thanx so much for that link to a solution. I've studied that and it does work. 
          I also had a reply (via another thread that he was helping me on) from SWS. He suggested the following which also works perfectly for my problem so I thought I would post it here, just in case anyone else has the same deal and needs an alternative solution. This way was considerably easier and saved me having to change my layouts. Just added a timestamp field to my appointments table and it's working!

          Hope the following helps someone else.

           

          Instead of taking advantage of 'create records via this relationship' which it sound like that is the way you are doing it, you may instead want to do something like add a button to create a new related record, which runs the following script  :

           

          Freeze Window 

          Set Variable [ $parent_id : main_table::id ]

          Goto Layout [ appointments ]

          New Record

          Set Field [ foreign_id ; $parent_id ]

          Go to layout [ original layout ]

          Go to object [ portal object name ]  // give the portal a name via the object info box ( or inspector box in 11 )

          Go to portal row first

           

          Assuming, you are sorting by something like a created timestamp, which is automatically entered when creating new appointment records.