8 Replies Latest reply on Apr 1, 2013 10:46 AM by StevenMoore_1

    Portal records in the wrong order

    ChrisSmythe

      Title

      Portal records in the wrong order

      Post

           Hello, I am running FileMaker Pro v12 on Windows XP and have just created a portal which is meant to do the following (please see attached image and also my database at the following link:

           https://www.sugarsync.com/pf/D0681807_60165357_45551  (Account Name: Admin   Password: click on OK as there is no password).

           If you open the Personnel Layout and click on the Special Considerations tab, you will see a portal similar to the one in the image below.

           The database user uses their mouse to firstly click on the Date button (this inserts today's date), then clicks on the Time button (this inserts today's current time) and then types in the Special Considerations text field.

           This appears to work OK.  I need the entered portal records for Special Considerations to be in descending order (which they are).

           Lastly, the blank Special Considerations record shown at the bottom of the Special Considerations portal needs to be the first portal record in the list (not the last as shown in the image below).

           I have no idea how to do this?

           Could you please advise on how I can do this?

           Kind regards,

           Chris smiley
            

      Image_1.jpg

        • 1. Re: Portal records in the wrong order
          Sorbsbuster

               Do you mean that the last portal row shown is the next new related records, waiting for you to complete the details?  if so, that 'new related record' is always at the bottom of the portal.

               (You could consider, btw, making one button insert both the current date and the current time in one click.)

          • 2. Re: Portal records in the wrong order
            ChrisSmythe

                 Hello Sorbsbuster, thank you for your help - much appreciated.  Yes, your are correct, the last portal row shown is the next new related record.

                 It just means that the database user will have to scroll down to the bottom of the portal to enter a new record.

                 I did consider making a button to insert both the current date and time in one click, but did not know how to do this?

                 Kind regards.

                 Chris smiley

            • 3. Re: Portal records in the wrong order
              hbrendel

                    

                   Change the relationship of your portal so that the creation of new records through the relationship is no longer allowed. Now, your portal does not show the empty line any more.

                   Create a button named 'New Consideration' which runs a script.

                   In the script:

                   1. Freeze Window

                   2. Store the value of the key field in a variable

                   3. Create a record in the related table (you need to go to a layout which belongs to the related table)

                   4. Set the foreign key field to the value of the variable

                   5. Fill the date and time fields

                   6. Go back to the original layout

                   7. Enter the field 'Special Considerations'

                   The new portal line will appear on the top with the cursor blinking in the field 'Special Considerations'

              • 4. Re: Portal records in the wrong order
                ChrisSmythe

                     Hello hbrendel, thank you for your solution on how I can the blank SpecialConsiderations Record to show at the top of my SpecialConderations Portal - very much appreciated.

                     I will change the relationship as suggested - excellent idea.

                     I want to create a button which runs a script as suggested but really have no idea about variables?

                     Step 2 - Do you want me to store the value in the SpecialConsiderations::LinkToEmployeeID field in a variable?

                     I am confused about Step 3 - creating a record in the DeploymentDetails Table (related table) --- do I need to create a new field to do this?

                     Step 4 - Do you want me to store the value in the DeploymentDetails::LinkToEmployeeID field (foreign key) in a variable?

                     Step 7 - Do you want me to enter in the text "Special Considerations" into the SpecialConsiderations::SpecialConsiderations field?

                     Any further assistance in helping me do this would be greatly appreciated.

                     Kind regards,

                     Chris smiley

                • 5. Re: Portal records in the wrong order
                  ChrisSmythe

                       Hello, if anyone could please get me started with variables as discussed in the previous posts so that I can implement hbrendel's kindly provided suggestion of creating a button to run a script, it would be much appreciated, as I have no real concept or ideas about variables.

                       Kind regards,

                       Chris smiley

                  • 6. Re: Portal records in the wrong order
                    philmodjunk

                    # 1. Freeze Window
                         Freeze window
                    #2. Store the value of the key field in a variable
                         Set variable [$ID ; value: Personnel::PersonnelID ] ----> Guessing the field and table name here
                    #3. Create a record in the related table (you need to go to a layout which belongs to the related table)
                         Go To Layout [ Considerations (Considerations)]
                         New Record/Request
                    #4. Set the foreign key field to the value of the variable
                         Set Field [Considerations::PersonnelID ; $ID ]
                    #5. Fill the date and time fields
                         Set Field [considerations::Date ; Get ( CurrentDate ) ]-----> instead of this set field step, define the field to auto enter the creation date
                         Set Field [Considerations::Time ; Get ( CurrentTime ) ]-----> instead of this set field step, define the field to auto enter the creation time
                    #6. Go back to the original layout
                         Go to Layout [original layout]
                    #7. Enter the field 'Special Considerations'
                         Go to Field [ Considerations::SpecialConsiderations

                          

                    • 7. Re: Portal records in the wrong order
                      ChrisSmythe

                           Thank you PhilModJunk - I had no idea about this before your post.  Now that I can read your post, it makes good sense to me. Again, thank you; your efforts are truely appreciated.

                           Kind regards,

                           Chris smiley

                      • 8. Re: Portal records in the wrong order
                        StevenMoore_1

                             I have a similar situation.  I have a basic portal with contact notes and I have to scroll all the way to the bottom every time I want to add a new note.  But I just assumed that I could simply add a button to simply "add a new portal record" or something like that.  I figured I'd hit the button and it would simply take me to the blank portal record.  Wouldn't that work?  Of course I don't actually "see" a ready-made script that says "add new portal record" but I just assumed there was an easy way to do that (???) without all the setting of variable IDs and stuff above.  No?